Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I have a visual with sales per week in a stacked bar chart, split by brand.
Now I want to make a parameter tot switch between the absolute numbers and % of total per week.
So like below:
week | Brand | Sales | % of total |
1 | A | 50 | 33% |
1 | B | 100 | 67% |
2 | A | 75 | 50% |
2 | B | 75 | 50% |
3 | A | 30 | 20% |
3 | B | 120 | 80% |
I know I can do this with bookmarks, but I already using some bookmarks, and I want to cover it by using only 1 parameter to switch between these measures.
What should be my formula?
HI @Sander1401,
You can create a parameter table with category types that use on the slicer as selectors to interact with measure expression to switch different values.
Switching Measures and Titles Dynamically in Power BI - The Data School Australia
Notice: Dax expression does not support returning two or more display formats except you change the measure data type to text.
Regards,
Xiaoxin Sheng
Thanks, I think my question was somewhat unclear, my problem was the dax formula of the last column...
Hi @Sander1401,
You can try to use the following measure formula if it is suitable for your requirement:
formula =
DIVIDE (
CALCULATE (
SUM ( Table[Sales] ),
ALLSELECTED ( Table ),
VALUES ( Table[Week] ),
VALUES ( Table[Brand] )
),
CALCULATE (
SUM ( Table[Sales] ),
ALLSELECTED ( Table ),
VALUES ( Table[Week] )
)
)
Regards,
Xiaoxin Sheng
@Sander1401 , Measure slicer can help. Or calculation group can help. Format change will happen in calculation group only
measure slicer
https://www.youtube.com/watch?v=b9352Vxuj-M
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...
https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...
https://www.youtube.com/watch?v=vlnx7QUVYME
calculation groups
https://www.sqlbi.com/blog/marco/2020/07/15/creating-calculation-groups-in-power-bi-desktop/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
88 | |
63 |