Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi Everyone,
I have a table which is shown below for FY25.
I have a table called Selected_Measure_2, in which I would like to use to toggle between "Grand Total" and "YTD Total".
How do I set it up so that when "YTD Total" is selected in the slicer, the matrix above displays data from Jul 24 to MMM YY?
Also, when "Grand Total" is selected in the slicer, the matrix above displays the whole Financial Year?
My DAX is also provided, just in case it needs tweaking.
Thanks,
Arnie.
Hi @arnie ,
To set up a toggle slicer in Power BI so that selecting "YTD Total" or "Grand Total" dynamically adjusts the matrix, follow these steps:
Steps to Implement:
Toggle Total =
VAR CurrentSelection = SELECTEDVALUE('Selected_Measure_2'[View])
VAR CurrentDate = TODAY()
VAR CurrentMonthYear = FORMAT(CurrentDate, "YYYYMM")
VAR StartMonthYear = "202407" -- Replace this with the start of your financial year
VAR YTDTonnes =
CALCULATE(
[_Calc. Budget],
'Date'[Year-Month Code] >= StartMonthYear,
'Date'[Year-Month Code] <= CurrentMonthYear
)
VAR GrandTonnes =
CALCULATE(
[_Calc. Budget],
'Date'[Year-Month Code] >= StartMonthYear
)
RETURN
SWITCH(
TRUE(),
CurrentSelection = "YTD Total", YTDTonnes,
CurrentSelection = "Grand Total", GrandTonnes,
BLANK()
)
Set Up the Slicer
Add a slicer to your report and bind it to the View column from the Selected_Measure_2 table.
Ensure it displays the options YTD Total and Grand Total.
Format the Matrix for Correct Display
Ensure your matrix rows and columns are configured with fields like Product Type, Order Group, and Year-Month to properly summarize the data.
Explanation of the Logic:
Testing:
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
121 | |
80 | |
76 | |
60 | |
57 |
User | Count |
---|---|
128 | |
112 | |
96 | |
70 | |
69 |