Forum Discussion
Dynamic Yearly Date Ranges based on a Max Date (2)
- 5 years ago
Hi garynorcrossmmc ,
If you want to create date range based on the maximum date from another slicer. Calculated column is not an approach to you.
You can create a unassociated table for slicer:
Then use the following measure in your report:
Measure1 = SWITCH(SELECTEDVALUE('Table[RANGE]'),"-12Months",CALCULATE([Your Measure],DATEADD('HR DIM_MONTH'[Date (End of Month)],-1,YEAR)),"-24Months",CALCULATE([Your Measure],DATEADD('HR DIM_MONTH'[Date (End of Month)],-2,YEAR)),"-36Months",CALCULATE([Your Measure],DATEADD('HR DIM_MONTH'[Date (End of Month)],-3,YEAR)),[Your Measure])Or you can also use calculation group in your data model, please refer to https://www.sqlbi.com/articles/introducing-calculation-groups/
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi garynorcrossmmc ,
If you want to create date range based on the maximum date from another slicer. Calculated column is not an approach to you.
You can create a unassociated table for slicer:
Then use the following measure in your report:
Measure1 = SWITCH(SELECTEDVALUE('Table[RANGE]'),"-12Months",CALCULATE([Your Measure],DATEADD('HR DIM_MONTH'[Date (End of Month)],-1,YEAR)),"-24Months",CALCULATE([Your Measure],DATEADD('HR DIM_MONTH'[Date (End of Month)],-2,YEAR)),"-36Months",CALCULATE([Your Measure],DATEADD('HR DIM_MONTH'[Date (End of Month)],-3,YEAR)),[Your Measure])
Or you can also use calculation group in your data model, please refer to https://www.sqlbi.com/articles/introducing-calculation-groups/
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai