cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sander1401
Helper I
Helper I

Percentage of total per week - stacked barchart

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:

weekBrandSales% of total
1A5033%
1B10067%
2A7550%
2B7550%
3A3020%
3B12080%

 

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?

4 REPLIES 4
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.