Forum Discussion
AndrewUrban
4 years agoFrequent Visitor
Trended Weeks over Prior Period Help
Hello! I'm hoping someone can help me write a DAX statement for a prior period (latest 12, 26, 52 weeks) which I'd like to then turn into a % chg. I have weekly data now which i've created trend...
- 4 years ago
This is fantastic! I think I can figure out the rest from here, thank you so much for breaking this down.
v-jianboli-msft
Community Support
4 years agoHi AndrewUrban ,
Please follow these steps:
1. Create a new table with all the options you need in the slicer.
2. Turn the single select of the slicer on
3. Then create a measure that calculate a prior period.
Measure =
SWITCH( MAX('for sliceer'[Value]),
"Last 12 Weeks",
CALCULATE(SUM(Kroger[Units]),FILTER(ALL('Date'),'Date'[Week Rank] >= MAX('Date'[Week Rank])-11 && 'Date'[Week Rank] <= MAX('Date'[Week Rank]))),
"Last 26 Weeks",
CALCULATE(SUM(Kroger[Units]),FILTER(ALL('Date'),'Date'[Week Rank] >= MAX('Date'[Week Rank])-25 && 'Date'[Week Rank] <= MAX('Date'[Week Rank]))),
CALCULATE(SUM(Kroger[Units]),FILTER(ALL('Date'),'Date'[Week Rank] >= MAX('Date'[Week Rank])-51 && 'Date'[Week Rank] <= MAX('Date'[Week Rank])))
)
4. Final output
In addition, what's the logic of "a % chg", please provide more details to help us clarify your scenario.
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AndrewUrban
4 years agoFrequent Visitor
This is fantastic! I think I can figure out the rest from here, thank you so much for breaking this down.