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

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.

Reply
mreynaud
Frequent Visitor

How do I calculate a percent column based on two aggregate sum columns from a matrix?

Hello all,

In Power BI, I created a matrix that looks something like this (I made a sample matrix from a sample data set in excel, but just pretend it's in Power BI):

2021-10-28_11-07-13.png

The matrix automatically calculated the sums of beaches and parks.

 

Here is an example of the dataset the matrix is built from:

2021-10-28_10-57-24.png

In the Power BI matrix this is how the data is arranged:

rows=location

columns= type, department

values= count of beaches, count of parks

 

And I want to create a new column in the matrix that calculates the percentact difference based on the sum beach/park counts:

2021-10-28_11-09-53.png

 

However, I've tried creating new measures but ran into errors. I saw from other posts that you would need to create a new column, which will technically work but then it has been calculating the percentage incorrectly.

 

When I create new percent coulumn Power BI has been calculating it based on my dataset, like this: 

2021-10-28_11-16-50.png

And when I add the % column to the value section of my matrix, it calculates a sum of my percentage. Which is not what I want:

2021-10-28_11-17-10.png

 

How do I calculate a percent column based on two aggregate sum columns from a matrix?

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

@mreynaud 
Yes, you can always use the fields(either column or measure value) to create new measures and include in your report visuals.

 

 

Paul Zheng _ Community Support Team

mreynaud
Frequent Visitor

I think I just solved it by creating a new measure: 

divide(sum(Table["Count of Beaches"]), sum(Table["Count of Parks"]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.