Forum Discussion
Anonymous
5 years agoNot applicable
DAX Calculation for Dates
Hi, I have a datasource that updates at a regular basis, is there a way to categorize them, for either "Current" or "Previous" then the rest will be NULL. Current means Latest update Previo...
- Anonymous5 years ago
Hi Anonymous ,
You can create the following measure
Week = var _rank=RANKX(ALL('Table'),CALCULATE(MAX('Table'[Last Update Date])),,DESC,Dense) return IF(_rank=1,"Current Week",IF(_rank=2,"Previous Week","Null"))If you only want to keep three rows, write a metric to keep the first three rows.
Measure = var _rank=RANKX(ALL('Table'),CALCULATE(MAX('Table'[Last Update Date])),,DESC,Dense) return IF(_rank<=3,1)Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
5 years agoNot applicable
Hi Anonymous ,
You can create the following measure
Week = var _rank=RANKX(ALL('Table'),CALCULATE(MAX('Table'[Last Update Date])),,DESC,Dense)
return IF(_rank=1,"Current Week",IF(_rank=2,"Previous Week","Null"))
If you only want to keep three rows, write a metric to keep the first three rows.
Measure = var _rank=RANKX(ALL('Table'),CALCULATE(MAX('Table'[Last Update Date])),,DESC,Dense)
return IF(_rank<=3,1)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.