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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Calculate Percentage on Final Data Presented in a Chart Visualization

Hi Everyone,

 

I have a clustered column chart (below) that shows Revenue (light blue) and Margin (dark blue) over the span of a few years. This data is taken from 10,000 rows along with multiple filters. I am curious how I can calculate the percentage (margin/revenue) between these two final columns and show it on a secondary axis as a line chart in Power BI. 

 

Any help would be great!

Clustered Column.png

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1673593509156.png

Here are the steps you can follow:

1. Create measure.

Measure 
SUMX(
FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&'Table'[Group]=MAX('Table'[Group])),[Value])
Measure 2 =
var _revenue=
SUMX(
FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&'Table'[Group]="Revenue"),[Value])
var _margin=
SUMX(
    FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&'Table'[Group]="Margin"),[Value])
return
DIVIDE(_margin,_revenue)

2. Select Line and clustered column chart visual, place [Measure] to Column y-axis, [Measure2] to Line y-axis.

vyangliumsft_1-1673593509158.png

3. Result:

vyangliumsft_2-1673593509163.png

 

Best Regards,

Liu Yang

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

1 REPLY 1
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1673593509156.png

Here are the steps you can follow:

1. Create measure.

Measure 
SUMX(
FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&'Table'[Group]=MAX('Table'[Group])),[Value])
Measure 2 =
var _revenue=
SUMX(
FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&'Table'[Group]="Revenue"),[Value])
var _margin=
SUMX(
    FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&'Table'[Group]="Margin"),[Value])
return
DIVIDE(_margin,_revenue)

2. Select Line and clustered column chart visual, place [Measure] to Column y-axis, [Measure2] to Line y-axis.

vyangliumsft_1-1673593509158.png

3. Result:

vyangliumsft_2-1673593509163.png

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.