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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
mjsteele12
Frequent Visitor

Dax measure- sum of percent of total by group with condition

For simplicity sake, I have the following dummy data:

id  val
1   5
1   30
1   50
1   15
2   120
2   60
2   10
2   10

My desired output is the following:

id  SUM_GT_10%
1   95%
2   90%

SUM_GT_10% can be obtained by the following steps:

  1. Calculate the sum of val for each id
  2. Divide val by 1
  3. sum of 2 if 2 > 10%

using the example data, the sum of val is 100 for id 1 and 200 for id 2, so we would obtain the following additional columns:

id  val   1      2   
1   5     100    5%
1   30    100    30%
1   50    100    50% 
1   15    100    15%
2   120   200    60%
2   60    200    30%
2   10    200    5%
2   10    200    5%

And our final output (step 3) would be sum of 2 where 2> 10%:

id   SUM_GT_10%
1    95%
2    90%

I don't care about the intermediate columns, just the final output, of course.

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@mjsteele12 

You can try this measure:

Fowmy_0-1596117771933.png

 



SUM 10% = 

VAR _TOT = 
    CALCULATE(
        SUM('Table'[VAL]),
        ALLEXCEPT('Table','Table'[ID])
)

VAR _VAL = 

SUMX(
FILTER(
ADDCOLUMNS(
    'Table',
    "VAL%", 
    DIVIDE(
        ('Table'[VAL]),
        _TOT
    )
),
[VAL%] > 0.1), 'Table'[VAL])
RETURN
DIVIDE(
    _VAL,
    _TOT
 )



________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@mjsteele12 

You can try this measure:

Fowmy_0-1596117771933.png

 



SUM 10% = 

VAR _TOT = 
    CALCULATE(
        SUM('Table'[VAL]),
        ALLEXCEPT('Table','Table'[ID])
)

VAR _VAL = 

SUMX(
FILTER(
ADDCOLUMNS(
    'Table',
    "VAL%", 
    DIVIDE(
        ('Table'[VAL]),
        _TOT
    )
),
[VAL%] > 0.1), 'Table'[VAL])
RETURN
DIVIDE(
    _VAL,
    _TOT
 )



________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

This worked wonderfully, I can't thank you enough. Dax is proving challenging to learn, coming from other languages..

@mjsteele12 

Appreciate it!

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Not sure if you are on s/o but if you want to get the reputation, you can add your answer here:

https://stackoverflow.com/questions/63173853/dax-measure-sum-of-percent-of-total-by-group-with-condi...

 

@mjsteele12 

Thanks, 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.