Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone!
I'm trying to calculate the change in two quarters, I think I'm getting close but not sure what else I am missing in my formula and hoping that someone can help. Basically, user will select a quarter and the KPI will show current value and what the change was from prior quarter.
Here are the sales figures:
Current Quarter Sales: 356
Previous Quarter Sales: 524
I created two variables to return the start dates, one for current quarter and another for previous quarter:
vCurrentQuarter: date(min([Year Month]),'YYYY-MMM')
vPreviousQuarter: date(addmonths(min([Year Month]),-3),'YYYY-MMM')
Calculation for Previous quarter sales: sum(${<'$(vCurrentQuarter)' ={"$(vPreviousQuarter)"}>} Sales)
The calculation keeps giving me current quarter sales. What am I missing? Thanks in advance!
@snancyiv Once you have a well-formatted date field, try these
Current: Sum({<[Date Field]={">=$(=Quarterstart(today(1)))<=$(=Quarterend(today(1)))"}>}Sales)
Previous: Sum({<[Date Field]={">=$(=Quarterstart(today(1),-1))<=$(=Quarterend(today(1),-1))"}>}Sales)
Hi @BrunPierre ,
I'm still getting current quarter values. For more reference, the filter to to select quarters is based on the quarter start date, "QuarterStart" which is calculated field in the script as Quarterstart(Date).
Provide some samples of the data.
Removed sensitive info from the original. Please filter "YearQuarter" on 2022-Q4 when you open it to see my example.
The association is on Date to Discharge Date. When you filter on 2022-Q4, it should be:
Current Quarter TotalNumerCase: 107
Previous Quarter TotalNumerCase: 162
Maybe this
Current Quarter: Sum({<DischargeDate={">=$(=QuarterStart(Max(DischargeDate),-1))<=$(=AddMonths(Max(DischargeDate),-3))"}>}TotalNumerCase)
Previous Quarter:Sum({<DischargeDate={">=$(=QuarterStart(Max(DischargeDate)))<=$(=AddMonths(Max(DischargeDate),0))"}>}TotalNumerCase)
Hi,
Current Quarter : sum({<[Date-DischargeDate]={">=$(=QuarterStart(Max([Date-DischargeDate]))) <=$(=QuarterEnd(max([Date-DischargeDate])))"}>}TotalNumerCase)
Previous Quarter : sum({<[Date-DischargeDate]={">=$(=QuarterStart(Max([Date-DischargeDate]),-1)) <=$(=QuarterEnd(max([Date-DischargeDate]),-1))"}>}TotalNumerCase)
Thanks,
Krishna
I still get the same amount as current quarter for previous calculation. 😞
Still getting the same amount as current quarter