Forum Discussion
Selection from Slicer (Current and Previous)
Hi,
In my report, I have Slicer. This Slicer allow user to choose time (Current Month, Current Quarter, Current Year have been pre-defined for user to choose).
I have a Clustered Column Chart in the report to show the Expense by Department, by Time (selection from the Slicer). So in this case, X-axis is Department, Y-axis is Expense and Time is Legend that have been defined in this visual Property. All working fine.
But what I need to achieve is dynamically display the same period of previous year. Example, if user select Current Month, and the report will also display Curret Month of Previous Year. If the user select Current Quarter, it also display Current Quarter of Previous Year.
How can I filter the Time dynamically based on the user selection from the Slicer? If user select Current Month, I need choose Current Month Previous Year also.
Please help. Thanks in advance.
2 Replies
- FreemanZ
Super User
you would need a measure for the same peroid of last year,
functions like DATEADD, SAMEPERIODLASTYEAR will do.
check this
https://community.powerbi.com/t5/Desktop/DATEADD-function/td-p/2113441
https://learn.microsoft.com/en-us/dax/sameperiodlastyear-function-dax
- sarikei
Helper I
Thanks for that but what I need is dynamically change the filter of the Legend. If user select Current Month, then it should have selected the Current Month of Previous Year too automatically. So on the Clustered Column Chart, you see Current Month and Current Month of Previous Year.
How can I select the Current Month of Previou Year dynamically/automatically based on user selection from Slicer?