cancel
Showing results 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

Helper I

## Measure as Category for Visuals

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

The requirement is.

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.

1 ACCEPTED SOLUTION
Community Support

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%"
)``````

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

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.

2 REPLIES 2
Community Support

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%"
)``````

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

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.

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",
"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.

Announcements

#### 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.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### 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
Top Kudoed Authors