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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Using DAX to get the total sum of a measure

Hey,

 

I have a column of data and beside it a dax measure:

Item 1 | 60

Item 2 | 30 

Item 3 | 30

 

I need to create a third measurement, which is the first dax measure divided by the sum of all the dax measures in that second column. For ex, the third measure for item 1 would be 60/(60+30+30)

Item 1 | 60 | 60/(60+30+30)

Item 2 | 30 | 30/(60+30+30)

Item 3 | 30 | 30/(60+30+30)

 

How can I obtain the sum of the first dax measure so that I can divide the first dax measure by the total sum of the first dax measure? Research has led me to a lot of similar questions but no great answers yet. SumX, All, Allselected don't appear to obtain this number.

 

Thanks!

4 REPLIES 4
AlanRGroskreutz
Helper II
Helper II

I'm trying to do the same thing, but the DAX measure isn't part of a table as a calculated column, it's just a standalone Measure (or variable) named "distance".  I need to create a seperate variable wivch would be like the example above.  In this case it would be similar to Measure =distance/SUMX(distance).

ChrisMendoza
Resident Rockstar
Resident Rockstar

@Anonymous,

 

Try something like:

 

Measure = 
VAR totalSum = CALCULATE(SUM(YourTableName[Value]),ALL(YourTableName))

VAR valueTotal =  SUM(YourTableName[Value]) 

RETURN DIVIDE(valueTotal,totalSum,0)





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Anonymous
Not applicable

Thanks for the reply Chris,

 

I actually needed all filters to remain present except the context filter. I realized this could be accomplished by using AllSelected and specifying the columns causing row splits in your table, in this case the column for item1, item2, and item3. 

 

MeasureTitle = CALCULATE(SUM(table[column]), ALLSELECTED(table[column]))

 

Anonymous
Not applicable

It seems like part of the key would be to ignore the row context. 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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