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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.