Alteryx Designer Desktop Discussions

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

Calculating prorated value for each month based on date range

hemant86
11 - Bolide

Hi Team, I have below table,

 

AMOUNTStartDateEndDate
20006/11/20237/31/2023
25007/1/20237/31/2023
50005/21/20237/31/2023
40004/14/20237/31/2023

 

Need the output as below. Now, first step is to check number of months between StartDate and EndDate. Then calculate days worked in all the months by the employee. For example the 3rd line item start date is 5/21/2023 so number of days worked by employee is 11. Similarly for June its 30 and July its 31. Then I'm calculating the prorated amount for each month and adding up at the end. Now the requirement here is how do I pick up number of months between StartDate and EndDate and also month Name or month number to extract total number of days in that month. As of now I have fixed the max number of month between dates to 4 but it might change. Appreciate any help around this. Apologies if I'm not very clear with the requirements  

 

Output:

THIS Column is not required as output. Just for your understandingAMOUNTStartDateEndDateDaysMonth1DaysMonth2DaysMonth3DaysMonth4ProratedMonth1ProratedMonth2ProratedMonth3ProratedMonth4Total Amount
Calculating working days for 2 months June and July20006/11/20237/31/20232031  1333.332000.00  3333.33
Calculating working days for 1 month July25007/1/20237/31/202331   2500.00   2500.00
Calculating working days for 3 months May, June and July50005/21/20237/31/2023113031 1774.195000.005000.00 11774.19
Calculating working days for 4 months April, May, June and July40004/14/20237/31/2023173130312266.674000.004000.004000.0014266.67
4 REPLIES 4
Peachyco
11 - Bolide

Maybe something like this:

Alteryx screenshot.png

Alteryx screenshot.png

Pang_Hee_Choy
12 - Quasar

similar concept workflow.

generate by month instead of rows.

Rename before multiple joins, and do not change sorting in multiple joins so that column sorting is sort nicely. 

Screenshot 2023-09-27 171111.png

Christina_H
14 - Magnetar

Here's my version, using very similar principles

image.png

hemant86
11 - Bolide

Thanks @Pang_Hee_Choy@Christina_H ..These solutions works great for me. Appreciate your help🙂 

Labels