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
k123
Frequent Visitor

How to divide a column value by a measure?

Hi,

 

I am trying to create some measures in power bi, where I want to divide each score by the sum of scores for each group

 

My data looks like following:

Capture-112.PNG

 

I created a meaure to get sum of scores by each group, the measure formula used:

 

Sum by Group = SUMX(VALUES('Table'[group]), CALCULATE( SUM('Table'[score])))

 

Now I want to create a measure to divide each score in the score column by its corresponding 'Sum by Group' .

 

Please let me know. Thanks!

 

 

1 ACCEPTED SOLUTION

@k123,

 

You may refer to the measure below.

Measure =
DIVIDE (
    SUM ( Table1[score] ),
    CALCULATE ( SUM ( Table1[score] ), ALLSELECTED ( Table1[category] ) )
)
Community Support Team _ Sam Zha
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

4 REPLIES 4
Anonymous
Not applicable

you can try

 

divide(SUM ( Table1[score]),calculate(SUM ( Table1[score]),ALLEXCEPT(TABLE1,Table1[category])))

Anonymous
Not applicable

I'm thinking you're looking for a result like this, comparing each value to the total value of that group. You can leverage ALL and EARLIER to get the right context:

 

Percentage of Group Total = 
DIVIDE(Data[Score],
CALCULATE(
    SUM(Data[Score]),
    FILTER(Data, Data[Group] = EARLIER(Data[Group]))), 0)

 

 

image.png

@Anonymous Is there a way to create a measure instead of a column, like in your solution?

@k123,

 

You may refer to the measure below.

Measure =
DIVIDE (
    SUM ( Table1[score] ),
    CALCULATE ( SUM ( Table1[score] ), ALLSELECTED ( Table1[category] ) )
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.