My overall goal is the following: calculate the all-time distribution of attendance across all four fiscal quarters using only data from before the current fiscal year. I have a measure that does this accurately for the current filter context. What I can't seem to manage is figuring it out for previous quarters from the current context.
If I can calculate the all-time (pre-2015) attendance for the previous quarter, I can take it from there. I couldn't get the Date Intelligence functions to work because I had to unfilter, then refilter the year field. Here's my Quarterly attendance measure. I just can't figure out how to walk it back a quarter.
QTotal:=CALCULATE(SUM([CNF]),
ALLEXCEPT(DateTable,DateTable[ACQuarter]),
DateTable[ACYear]<2015)
The next thing I tried was specifying the quarter directly in the filter. The following measure reliably calculates the previous quarter number:
PrevQ:=MOD(LOOKUPVALUE(DateTable[ACQuarter],
DateTable[DateKey],
FIRSTDATE(DateTable[DateKey]))-2,4)+1
But when I sub it into the following measure...
Test:=CALCULATE(SUM([CNF]),
FILTER(ALL(DateTable),
DateTable[ACQuarter]=[PrevQ] &&
DateTable[ACYear]<2015))
...all I get are blanks. The exact same measure with a number instead of the measure works, though. I guess it's calculating [PrevQ] in the inherited ALL context instead of the unaltered filter context.
What am I missing? Any help would be greatly appreciated.