Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
74 | |
63 | |
51 | |
48 |
User | Count |
---|---|
211 | |
86 | |
64 | |
59 | |
56 |