Forum Discussion
Switch 3 measures with one click
Hi All,
I want to show 3 measures old or new with the toogle switch.This can be done with bookmarks and it is woking right now.to implemet this in number of pages with different filter context.Is there any way to show only new measurs when the toogle switch is on and vice versa without bookmarks?
Thanks
Hi Varshi288 ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you burakkaragoz for the prompt response.
I have replicated the scenario using sample data.Please go through the attached PBIX file for your reference.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you.
5 Replies
- burakkaragoz
Super User
Hi Varshi288 ,
Yes, you can achieve this without using bookmarks by creating a “helper” table and a dynamic measure that responds to the toggle switch selection.
Here’s how you can do it:
Create a Helper Table for the Toggle
- In Power BI, go to “Enter Data” and create a table like:Switch
Old New - Name this table something like “ToggleTable”.
- In Power BI, go to “Enter Data” and create a table like:Switch
Add a Slicer
- Add a slicer visual to your report using the “Switch” column from the “ToggleTable”. This will act as your toggle.
Create a Dynamic Measure
- Write a measure that checks the selection and returns the appropriate values. For example:
DAXSelected_Measure = VAR Toggle = SELECTEDVALUE(ToggleTable[Switch]) RETURN SWITCH( TRUE(), Toggle = "Old", [Old_Measure], Toggle = "New", [New_Measure], BLANK() )- If you want to switch between multiple measures, you can expand the SWITCH logic to include more options.
Use the Dynamic Measure in Your Visuals
- Add the “Selected_Measure” to your table or matrix. It will now update based on the slicer (toggle) selection.
Advantages:
- This method works across all pages and respects the filter context.
- No need for bookmarks, so it’s much easier to maintain.
Let me know if you need example DAX for your specific measures or more detail on any step!
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI - Varshi288
Resolver II
burakkaragoz Thank you for you quick response By expanding the switch logic it still shows only one measure. If i select Elim from the slicer it should show 3 measures TP_$,TP CM Scope and TP CM %.
- v-venuppu
Community Support
Hi Varshi288 ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you burakkaragoz for the prompt response.
I have replicated the scenario using sample data.Please go through the attached PBIX file for your reference.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you. - Varshi288
Resolver II
HI v-venuppu thank you for your detailed inputs on my issue. I managed solve the issue with different approch.
SP CM Scope = Var _SPCM_excl_oDC =CALCULATE(SUM(Data[SP $ (calc)])-sum(Data[DM (USD)])-sum(Data[DL (USD)])-sum(Data[Adjustment]),KEEPFILTERS(PU[PU]<>"elim"))Var _SPCM_Incl_oDC = CALCULATE(SUM(Data[SP $ (calc)])-sum(Data[DM (USD)])-sum(Data[DL (USD)])-sum(Data[Adjustment])-SUM(Data[oDC (USD)]),KEEPFILTERS(PU[PU]<>"elim"))returnIF(ISCROSSFILTERED('Selected Measure'[CM Scope]),SWITCH( TRUE(),VALUES('Selected Measure'[CM Scope])= "Excl other DC", _SPCM_excl_oDC,VALUEs('Selected Measure'[CM Scope])= "Incl other DC", _SPCM_Incl_oDC),_SPCM_excl_oDC)Thnaks once again.