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
Anonymous
Not applicable

Calculating Percentage of Total of a subset

Hi guys!

 

I've searched around and am unable to replicate a solution that works with my problem, so I'm hoping to find some help here!

 

I'm trying to calculate a percent of total while also excluding some values. For example, in the table below I want to calculate the total of % Won and also the total of % Lost, while excluding the numbers for any that are Open, Abandoned, or Alternates. 

 

So the end result that I'm driving towards would use a total amount of 43 units (sum of units - excluding open, abandoned, and alternates) with a Won % of 44% and a Lost % of 56%. 

 

My end goal is to be able to display these two percentages in seperate cards on my report that would also adjust when a single region or zone is selected. 

 

ZoneRegionStatusUnits
1ALost1
1AOpen5
1BWon6
1CAbandoned4
1CAlternate1
1CWon5
2DWon6
2DLost9
2ELost2
2FLost4
2FAbandoned7
2FOpen3
2FWon2
2GLost8
1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @Anonymous 

 

I created two measures, one that calculates the percentages for the status and the other one for the status lost

Measure Lost = 
var just_Won_Lost = 
    CALCULATE( 
        SUM( 'Table'[Units] )
        , KEEPFILTERS(
            'Table'[Status] IN { "Won" , "Lost" }
        )
    )
var just_lost = 
    CALCULATE( 
        SUM( 'Table'[Units] )
        , KEEPFILTERS(
            'Table'[Status] IN { "Lost" }
        )
    )
return
DIVIDE( just_lost , just_Won_Lost)

and the other one

Measure WON = 
var just_Won_Lost = 
    CALCULATE( 
        SUM( 'Table'[Units] )
        , KEEPFILTERS(
            'Table'[Status] IN { "Won" , "Lost" }
        )
    )
var just_Won = 
    CALCULATE( 
        SUM( 'Table'[Units] )
        , KEEPFILTERS(
            'Table'[Status] IN { "Won" }
        )
    )
return
DIVIDE( just_Won , just_Won_Lost)

And here is a screenshot using the measures inside a table visual and on two card visuals:

TomMartens_0-1602180843483.png

Hopefully, this is what you are looking for.

 

Regards,

Tom

 



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

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

5 REPLIES 5
TomMartens
Super User
Super User

Hey @Anonymous 

 

I created two measures, one that calculates the percentages for the status and the other one for the status lost

Measure Lost = 
var just_Won_Lost = 
    CALCULATE( 
        SUM( 'Table'[Units] )
        , KEEPFILTERS(
            'Table'[Status] IN { "Won" , "Lost" }
        )
    )
var just_lost = 
    CALCULATE( 
        SUM( 'Table'[Units] )
        , KEEPFILTERS(
            'Table'[Status] IN { "Lost" }
        )
    )
return
DIVIDE( just_lost , just_Won_Lost)

and the other one

Measure WON = 
var just_Won_Lost = 
    CALCULATE( 
        SUM( 'Table'[Units] )
        , KEEPFILTERS(
            'Table'[Status] IN { "Won" , "Lost" }
        )
    )
var just_Won = 
    CALCULATE( 
        SUM( 'Table'[Units] )
        , KEEPFILTERS(
            'Table'[Status] IN { "Won" }
        )
    )
return
DIVIDE( just_Won , just_Won_Lost)

And here is a screenshot using the measures inside a table visual and on two card visuals:

TomMartens_0-1602180843483.png

Hopefully, this is what you are looking for.

 

Regards,

Tom

 



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

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

@TomMartens 

 

This worked perfectly! Thank you for your help!

negi007
Community Champion
Community Champion

@Anonymous 

 

Create 3 measures

 

1. Total_Win_Loss = CALCULATE(SUM(Win_Lost[Units]),Win_Lost[Status] in {"Lost", "Won"})

2. Win% = DIVIDE(CALCULATE(SUM(Win_Lost[Units]),Win_Lost[Status]="Won"),[Total_Win_Loss])

3. Loss% = DIVIDE(CALCULATE(SUM(Win_Lost[Units]),Win_Lost[Status]="Lost"),[Total_Win_Loss])

 

negi007_0-1602180769797.png

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Anonymous
Not applicable

@negi007 

 

I tried creating your measures - no problem with the first one. On the second one, I'm getting the following error "Too few arguments were passed to the DIVIDE function. The minimum argument count for the function is 2."

 

I pasted below my current formula. Am I missing something?

 

Win % = DIVIDE(CALCULATE(SUM(opportunities[dms_countasunit]),opportunities[Status]="Won",opportunities[Total Win Loss])

@Anonymous 

 

have modified dax below, it should be working for you

 

Total_Win_Loss = CALCULATE(SUM(Win_Lost[Units]),Win_Lost[Status] in {"Lost", "Won"})
 
Win% = DIVIDE(CALCULATE(SUM(Win_Lost[Units]),Win_Lost[Status]="Won"),[Total_Win_Loss],0)
 
Loss% = DIVIDE(CALCULATE(SUM(Win_Lost[Units]),Win_Lost[Status]="Lost"),[Total_Win_Loss],0)



Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

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
Top Kudoed Authors