Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
sam_gift
Helper I
Helper I

Measure as Category for Visuals

Hi, I have a requirement which I am not able to solve.

The requirement is.

sam_gift_0-1701893152016.png

From the above table, Calculating the "% of Revenue" is percentage of sum of revenue to the grand total Revenue.

measure "Margin Bracket" tells in which bucket does "% of Revenue" falls into.
I have to use "Margin Bracket" measue in X-axis, I will be using it for Clustered Column Chart and Matrix.

I have added the link of  the sample pbi file. Please help.
https://drive.google.com/file/d/1FamafchyS7EesRNazhbzGHjaGBRIsg6e/view?usp=drive_link

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @sam_gift 

 

You can try the following methods.

New table = SUMMARIZE(Sheet1,Sheet1[Product],"Sum",SUM(Sheet1[Revenue]))

Column:

% = DIVIDE([Sum],SUMX(ALL('New table'),[Sum]))
New Margin Bracket = SWITCH(TRUE(),
                        [%]<0,"< 0%",
                        [%]<0.15,"0 - 15%",
                        [%]<0.30,"15 - 30%",
                        [%]<0.45,"30 - 45%",
                        [%]<0.60,"45 - 60%",
                        [%]>0.60,"> 60%"
)

vzhangti_0-1702263972795.png

The "New Margin Bracket" can be used as the X-axis.

vzhangti_1-1702264056588.png

Is this the result you expect? Please see the attached document.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @sam_gift 

 

You can try the following methods.

New table = SUMMARIZE(Sheet1,Sheet1[Product],"Sum",SUM(Sheet1[Revenue]))

Column:

% = DIVIDE([Sum],SUMX(ALL('New table'),[Sum]))
New Margin Bracket = SWITCH(TRUE(),
                        [%]<0,"< 0%",
                        [%]<0.15,"0 - 15%",
                        [%]<0.30,"15 - 30%",
                        [%]<0.45,"30 - 45%",
                        [%]<0.60,"45 - 60%",
                        [%]>0.60,"> 60%"
)

vzhangti_0-1702263972795.png

The "New Margin Bracket" can be used as the X-axis.

vzhangti_1-1702264056588.png

Is this the result you expect? Please see the attached document.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

123abc
Community Champion
Community Champion

Create a Measure for "% of Revenue": In Power BI, you can create a new measure to calculate the "% of Revenue." The formula might look something like this:

 

% of Revenue = SUM('YourTable'[Revenue]) / CALCULATE(SUM('YourTable'[Revenue]), ALL('YourTable'))

 

  1. Replace 'YourTable' with the actual name of your table.

  2. Create a Measure for "Margin Bracket": Since you already have a measure for "Margin Bracket," ensure it is correctly calculated based on the "% of Revenue." The formula might look like:

Margin Bracket =
SWITCH(
TRUE(),
[YourPercentageMeasure] >= 0 && [YourPercentageMeasure] < 0.2, "Bracket 1",
[YourPercentageMeasure] >= 0.2 && [YourPercentageMeasure] < 0.4, "Bracket 2",
-- Add more conditions as per your requirements
"Other"
)

 

  1. Replace [YourPercentageMeasure] with the actual name of your "% of Revenue" measure.

  2. Use "Margin Bracket" in Visualizations:

    • For Clustered Column Chart: Place "Margin Bracket" in the X-axis field well, and use other measures (like Revenue or % of Revenue) for the values.

    • For Matrix: Add "Margin Bracket" to the Rows or Columns field, and use other measures as needed.

Without the specific details or the sample file, I hope this general guidance helps you set up your visualizations in Power BI. If you encounter any issues or need further assistance, please provide more details or share the sample file for a more accurate solution.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors