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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jbezos
New Member

Creating Measures

 

 

Hi, First time using Power BI.  I'm trying to calculate the % distribution based on the values found in a column.  For example, I have a column of Fruits with Apples and Bananas as values.  I am trying to calulate the % highlighted in yellow.

 

 

Capture.GIF

THanks!

1 ACCEPTED SOLUTION
v-sihou-msft
Microsoft Employee
Microsoft Employee

@jbezos

 

As @Phil_Seamark said, it's better to pivot your dataset like:

 

67.PNG

 

You can use a matrix to render your data. Then you just need to create a measure to calculate the percentage of month total for current fruit.

 

Pct Of Month Total = SUM(Fruits[Volume])/CALCULATE(SUM(Fruits[Volume]),ALLEXCEPT(Fruits,Fruits[Month]))

8.PNG

 

 

Regards,

View solution in original post

2 REPLIES 2
v-sihou-msft
Microsoft Employee
Microsoft Employee

@jbezos

 

As @Phil_Seamark said, it's better to pivot your dataset like:

 

67.PNG

 

You can use a matrix to render your data. Then you just need to create a measure to calculate the percentage of month total for current fruit.

 

Pct Of Month Total = SUM(Fruits[Volume])/CALCULATE(SUM(Fruits[Volume]),ALLEXCEPT(Fruits,Fruits[Month]))

8.PNG

 

 

Regards,

Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @jbezos

 

I suggest you pivot your data to the following structure.

 

Month    , Fruit  , Value
------------------------------
1 Jan 17 , Apples , 1
1 Feb 17 , Apples , 5
1 Mar 17 , Apples , 15
1 Jan 17 , Bananas, 4
1 Feb 17 , Bananas, 10
1 Feb 17 , Bananas, 20

Once you have this structure you can create some measures like

 

Sum of Value = CALCULATE(SUM([Value]))

which you can drag to a matrix visual (Month on Rows, Fruit on Columns), twice.  The second time you add the measure to the grid, set the "show as percentage"

 

I think that will be close.

 

You can change the structure of your data in the Query Editor using the Unpivot function.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors