Forum Discussion
Past 4 Quarter Rolling Data Issues while applying Quarter filter
Hi,
i have task to compute the past 4 quarters sum dynamically based on the quarter field in base table
then i created one mapping to accomplish ( Actual quarter , Start qtr, End qtr )
Mapping Table
Actul Quarter StartQtr EndQtr
20171 20161 20164
then applied below DAX to get running 4 qtr total.
Last4Qtr_Production = CALCULATE(
[Measures_Count],
FILTER(,
Table[Quarter_Field] >= CALCULATE(MIN(PPM_Goal[Start_Qtr])) &&
Table[Quarter_Field] <= CALCULATE(MIN(PPM_Goal[End_Qtr])))
)
Sum of Past 4 quarters works fine
but i am facing other issues.. that if i apply quarter filter from mapping then other metric calculation not working
In case if i apply quarter filter from main table then this last4 quarter logic not working..
Help me to fix this issus.
7 Replies
- v-danhe-msft
Microsoft Employee
Hi Peter_Jeyaraj_I,
Could you please offer me some sample data and post your desired result if possible?
Regards,
Daniel He
- v-danhe-msft
Microsoft Employee
Hi Peter_Jeyaraj_I,
Could you please offer me some sample data and post your desired result if possible?
Regards,
Daniel He
- Peter_Jeyaraj_I
Helper II
Thanks for your response
For ex.. i have the Quarter wise count & i want to derive the last 4 quarter sum.. ie., 20151 quarter we need to consider 20141 to 20144 . here i below i shared some sample data.
Also, i tried to achive w/o mapping/calendar table as it's breaks other dax expression that i build in main table.
Quarter Count Last4Q Count 20141 12 0 20142 23 12 20143 16 35 20144 56 51 20151 16 107 20152 27 111 20153 20 115 20154 60 119 20161 20 123 20162 31 127 20163 24 131 20164 64 135 - AnonymousNot applicable
Try the following
1. After loading data go to Edit Query.
2. Sort the Table by th Quarter Column
3. Add Index column from 1
4. Create the measure
RunningTotal = CALCULATE(
SUM( Table1[Count] ),
FILTER( ALL(Table1) ,
SUMX( FILTER( Table1, EARLIER( Table1[Index] ) = Table1[Index] -4 ||
EARLIER( Table1[Index] ) = Table1[Index] -3 ||
EARLIER( Table1[Index] ) = Table1[Index] -2 ||
EARLIER( Table1[Index] ) = Table1[Index] - 1
) , Table1[Count] ) ) )If this works for you please accept this as solution and also give KUDOS.
Cheers
CheenuSing
Here is the sample output.