Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I have a problem with one of the logics that I need to place in my apps.
What I am trying to do is I need to calculate act_sales and est_sales based on the current quarter, Month and Day condition. Here’s what I am trying to achieve :
Conditions 1: When day of the current month is < = 8 and quarter = current quarter
for the current month (March)= sum of est sales
for last month (Feb)= sum of est sales
for prior to last month (Jan)= sum of actual sales
Conditions 2: When the day of the current month is > 8 and the quarter is the current quarter
for the current month (March)= sum of est sales
for last month (Feb) = sum of act sales
for prior to last month (Jan)= sum of act sales
Else (if previous quarters selected) then
sum(act Sales)
Now, this has to be dynamic. For example, if I select the 2019 Q2 next month April then it should not calculate previous months in the sales sums as in the current quarter next month the last month is 0 .
Any idea how to achieve this ?
here's the sample data looks like.
yes, looks good
Great !!
Create variables like below,
Current Month :
Last Month :
Regards,
Shuhbam