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

Percentage of row total excluding blanks?

Hey all,

 

Trying to calculate percentage of row total exluding blanks.

In this example, it's the proportions of individuals that fall into certain BMI categories for each year. 

To do this, I'm using the DAX:

Proportions = DIVIDE(COUNT('Fact Table'[PersonKey]),CALCULATE(COUNT('Fact Table'[PersonKey]),ALL('Measurement Details'[BMI Category])))

 

Issue is, some of the individuals don't have a BMI category stated, so there are blanks like so -

Mirae_0-1657118788537.png

 Is there a way to calculate these proportions exluding blanks?

- Thanks all! 

1 ACCEPTED SOLUTION
rbriga
Impactful Individual
Impactful Individual

Two approaches can solve this:

1. Assuming you filter out \ slice out the blank BMI

% In Population = 

    DIVIDE (
        COUNT ( 'Fact Table'[PersonKey] ),
        CALCULATE (
            COUNT ( 'Fact Table'[PersonKey] ),
            ALLSELECTED('Measurement Details'[BMI Category])
        )
    )

 

2. Assuming you don't manually filter out anything:

CALCULATE (
    DIVIDE (
        COUNT ( 'Fact Table'[PersonKey] ),
        CALCULATE (
            COUNT ( 'Fact Table'[PersonKey] ),
            REMOVEFILTERS ('Measurement Details'[BMI Category]  ),
            KEEPFILTERS ( NOT ( ISBLANK ( 'Measurement Details'[BMI Category] ) ) )
        )
    ),
    KEEPFILTERS ( NOT ( ISBLANK ( 'Measurement Details'[BMI Category] ) ) )
)

  

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!

View solution in original post

4 REPLIES 4
rbriga
Impactful Individual
Impactful Individual

You may add to the CALCULATE:

Proportions = 
DIVIDE(
 COUNT('Fact Table'[PersonKey]),
 CALCULATE(
    COUNT('Fact Table'[PersonKey]),
    REMOVEFILTERS('Measurement Details'[BMI Category]),
    KEEPFILTERS(NOT ( ISBLANK('Measurement Details'[BMI Category])))
         )
)
-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!
Anonymous
Not applicable

Thank you for such a prompt suggestion! Gave it a try but it's still considering those blanks (hid them in the filters in this example)

Mirae_0-1657118739155.png

 

 

rbriga
Impactful Individual
Impactful Individual

Two approaches can solve this:

1. Assuming you filter out \ slice out the blank BMI

% In Population = 

    DIVIDE (
        COUNT ( 'Fact Table'[PersonKey] ),
        CALCULATE (
            COUNT ( 'Fact Table'[PersonKey] ),
            ALLSELECTED('Measurement Details'[BMI Category])
        )
    )

 

2. Assuming you don't manually filter out anything:

CALCULATE (
    DIVIDE (
        COUNT ( 'Fact Table'[PersonKey] ),
        CALCULATE (
            COUNT ( 'Fact Table'[PersonKey] ),
            REMOVEFILTERS ('Measurement Details'[BMI Category]  ),
            KEEPFILTERS ( NOT ( ISBLANK ( 'Measurement Details'[BMI Category] ) ) )
        )
    ),
    KEEPFILTERS ( NOT ( ISBLANK ( 'Measurement Details'[BMI Category] ) ) )
)

  

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!
Anonymous
Not applicable

ALLSELECTED worked an absolute treat. Thank you so much! 😁

 

The section option didn't want to work for me, but I found tweaking it to the following did - sharing in case this helps anymore else

Pupil % = CALCULATE (
    DIVIDE (
        COUNT ( 'Fact Table'[PersonKey] ),
        CALCULATE (
            COUNT ( 'Fact Table'[PersonKey] ),
            REMOVEFILTERS ('Measurement Details'[BMI Category]  ),
            KEEPFILTERS ('Measurement Details'[BMI Category] <>BLANK()) 
        )
    ),
    KEEPFILTERS ('Measurement Details'[BMI Category] <>BLANK())
)

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.