Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I have 2 slicers as shown below:
1. Metric
2. Period
I have a combination Line/Bar chart as follows. The Metice slicer is Parametric slicer and works fine. I'd like to be able to combine the Period Slicer with the Metric Slicer such that when Revenue is selected and Period is selected the relevant values for Revenue are displayed i.e.
1. Revenue + Month = display revenue for the month,
2. Revenue + YTD = display YTD revenue for the month (in the bar for the month) and so on.
Below is the code for the Slicer (Parametric). This works fine and I am able to switch between the various Metrics without a problem.
Metric = {
    ("Revenue", NAMEOF('FSMeasures'[Revenue]), 0),
    ("Gross Profit", NAMEOF('FSMeasures'[Gross Profit]), 1),
    ("Net Profit", NAMEOF('FSMeasures'[Net Profit]), 2)
}
For the Time Intelligence slicer, I created a table as follows:
Period Order
| Month | 0 | 
| YTD | 1 | 
| TTM | 2 | 
The dax code I used to switch between the Periods here is:
Period = 
VAR P1 = SELECTEDVALUE('Table'[Order])
VAR M1 = SELECTEDVALUE(Metric[Parameter Fields]) 
VAR Result = 
            SWITCH(P1,
                0, M1,
                1, TOTALYTD(M1,DATESYTD('Calendar'[Date]),"12/31"),
                2, CALCULATE(M1,
		DATESINPERIOD('Calendar'[Date],MAX('Calendar'[Date]),-12,MONTH)
		),
                99999
            )
RETURN
    Result
The result I am getting is:
Any help is greatly appreciated.
Solved! Go to Solution.
@rnambiar this is not possible:
VAR M1 = SELECTEDVALUE(Metric[Parameter Fields]) 
For Time intelligence create a calculation group and in the calculation group use selectedmeasure() and that I think will do it.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Sooo much effort. Instead, enable "Personalize Visuals" and teach your users how to use it.
@rnambiar this is not possible:
VAR M1 = SELECTEDVALUE(Metric[Parameter Fields]) 
For Time intelligence create a calculation group and in the calculation group use selectedmeasure() and that I think will do it.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
YEs the calculation group worked
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.