Forum Discussion
dynamic date filter using slicer
Hi,
Let's say that I am building a financial dashboard for the organization and I want to present the comparison of current value with different time period.
For example, I am calculating IT cost using formula (X):
1 Reply
- v-yulgu-msftMicrosoft Employee
Hi vranjan22,
You need an extra table that lists all available time periods (Previous Month, Previous Quarter, Previous Year (YTD), etc.), to allow users to choose from. This table should be unrelated to any other data table. Then, you need to create five separate measures to return result for each period, suppose they are [Previous Month Cost], [Previous Quarter Cost], [Previous Year (YTD) Cost], etc. To dynamic select Y, you need below measure:
Selected Measure = VAR MySelection = SELECTEDVALUE ( 'Measure Selection'[Measure Name], "Sales" ) RETURN SWITCH ( TRUE (), MySelection = "Previous Month", [Previous Month Cost], MySelection = "Previous Quarter", [Previous Quarter Cost], MySelection = "Previous Year (YTD)", [Previous Year (YTD) Cost], BLANK () )
Here is a blog for your reference: Power BI – Using a Slicer to show different measures
Best regards,
Yuliana Gu