Forum Discussion
Sum Based on Slicer Date Selection
Hi,
I have matrix table i'd like to dynamically calculate measure based on date selection in slicer. I added a new column in the data table and called it "Slicer Dates'. I have a calendar Year column and Slicer Dates is added based on the values in Calendar Year column.
Slicer have 3 options. Last Month, Last Year and Year to Date
I have below forumula to sum values based on slicer date selection however it is giving me an error. Can anyone help with TY and LY (Last Year) calculation.
dokat , I think You need create measures -MTD, QTD,YTD etc and use measure slicer
measure slicer
https://www.youtube.com/watch?v=b9352Vxuj-M
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115
https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slicer-parameter-table-pattern
https://www.youtube.com/watch?v=vlnx7QUVYMEOr calculation groups
https://www.sqlbi.com/blog/marco/2020/07/15/creating-calculation-groups-in-power-bi-desktop/
2 Replies
- amitchandakSuper User
dokat , I think You need create measures -MTD, QTD,YTD etc and use measure slicer
measure slicer
https://www.youtube.com/watch?v=b9352Vxuj-M
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115
https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slicer-parameter-table-pattern
https://www.youtube.com/watch?v=vlnx7QUVYMEOr calculation groups
https://www.sqlbi.com/blog/marco/2020/07/15/creating-calculation-groups-in-power-bi-desktop/ - dokatPost Prodigy
I am using generic sum and previous year firmula for calculations. So rather than creating new measures for each time period i'd like to use the time period selected in the slicer. Is there a way to incorporate time selection in the slicer to the formula via selectedvalue?
This is what have for
TY: Calculate(SUM('P&L'[Values]), FILTER('P&L'[Slicer Dates] = ALLSELECTED('P&L'[Slicer Dates)))))
LY = CALCULATE(SUM('P&L'[Values]),DATEADD('P&L'[Calendar Year], -1, YEAR))