Forum Discussion
Week Filter
Hi
Does anyone know why this DAX doesnt work...
Example of my data table below:
So, the way that I would do this in a measure would be something along the lines of:
Prior Week = VAR __PreviousWeek = MAX('FactNELWeekly'[Previous Week No.]) RETURN CALCULATE([UAP's],FILTER('FactNELWeekly'[Week] = __PreviousWeek)
8 Replies
- v-kelly-msftCommunity Support
Hi Anonymous ,
Based on Greg_Deckler 's suggestion,the measure needs to be corrected as below:
Prior Week = VAR __PreviousWeek = MAX('FactNELWeekly'[Previous Week No.]) RETURN CALCULATE([UAP's],FILTER('FactNELWeekly','FactNELWeekly'[Week] = __PreviousWeek)WoW=[UPA's]-_PreviousWeekBest Regards,
KellyDid I answer your question? Mark my post as a solution!- Greg_DecklerCommunity Champion
Thanks v-kelly-msft ! That's what happens when I don't actually test my DAX, I mess up some syntax!
- AnonymousNot applicable
thank you so much!
this did the trick nicely, really appreciated!
- AnonymousNot applicable
Hi Kelly v-kelly-msft
I have an additional question on this topic, everything works with the DAX above, so thanks againn for that. But im noticing there's a week 0 appearing, and actually I've replicated this for a monthly report and again, im getting a 0 month. Is there a way to take care of this scenario within the same Dax formula? I figured it would be linked to this formula, hence why im posting here.
I'm googling this now acutally, but thought i'd try my luck here at the same time :).
Thanks
Ben
- Greg_DecklerCommunity Champion
So, the way that I would do this in a measure would be something along the lines of:
Prior Week = VAR __PreviousWeek = MAX('FactNELWeekly'[Previous Week No.]) RETURN CALCULATE([UAP's],FILTER('FactNELWeekly'[Week] = __PreviousWeek)- AnonymousNot applicable
Thank you so much, this worked!
Much appreciated.
- AnonymousNot applicable
HI,
It could be something like this (if it's a calculated column):
var previousWeek = FactNELWeekly[Previoud Week No.]return
CALCULATE([UAP's],FactNELWeekly[Week No.] = previousWeek) - AnonymousNot applicable
Solved:
UAPs Prior Week = VAR __PreviousWeek = MAX('FactNELWeekly'[Previous Week No.])returnCALCULATE([UAP's],FactNELWeekly[Week] = __PreviousWeek)Thanks to all who contributed!