We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Cost calculation based on date ranges

djones1979
5 - Atom

I'm a student trying to use Alteryx for the first time and I'm having trouble with a basic formula trying to calculate depreciation/carrying cost for any inventory purchased during the year.  This is what I have:

 

IF [Acquisition/Maturity Date]>=2020-06-30 AND [Acquisition/Maturity Date]<2021-06-30 THEN [Cost]*(.2) ENDIF

 

Can someone enlighten me as to where I'm going wrong?  Thanks!

4 REPLIES 4
CoG
14 - Magnetar

If your issue is that you are getting an error, that is because IF statements must be of the form

IF ... THEN ... ELSE ... ENDIF

 

It looks like you may be missing an ELSE statement.

 

Happy Solving!!!

Hammad_Rashid
11 - Bolide

IF [Acquisition/Maturity Date] >= '2020-06-30' AND [Acquisition/Maturity Date] < '2021-06-30' THEN
[Cost] * 0.2
ELSE
[Cost] // Placeholder for ELSE, you can modify this based on your requirements
ENDIF

 

This formula calculates the depreciation/carrying cost for inventory purchased during the specified date range. If the acquisition/maturity date falls between '2020-06-30' (inclusive) and '2021-06-30' (exclusive), it will calculate the cost multiplied by 0.2. Otherwise, it will use the original cost as a placeholder in the ELSE part. Adjust the ELSE part based on your specific requirements.

djones1979
5 - Atom

Thank you both very much!  I appreciate the feedback, and using your responses I was able to get exactly what I needed.

CoG
14 - Magnetar

@djones1979 

Glad we could help and well done! Please kindly mark as solved so that others can more easily find the solutions they're looking for. (You can mark both mine and @Hammad_Rashid 's answers as solutions)

 

Happy Solving!!!

Labels
Top Solution Authors