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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
weilai0521
Frequent Visitor

Exclude missing values with calculate

Hi,

 

I have a formula like this to calculate percentages which can be changing dynamically with age, gender filters. But there are some 'DATA'[XXX] with missing values "." and I want to exclude those missing values in the denominator. How can I do that? 

 

Thanks!

 

Lai

 

Percentage =
DIVIDE(
    calculate(sum('DATA'[Weight]),filter('DATA','DATA'[XXX]="Yes"&&'DATA'[Age]=[Selected_Age]&&'DATA'[Gender]=[Selected_Gender])),
    calculate(sum('DATA'[Weight]), allexcept('DATA','DATA'[Year],'DATA'[Age],'DATA'[Gender]))
)

2 ACCEPTED SOLUTIONS
Stachu
Community Champion
Community Champion

add the 

DATA[XXX]<>"."

to your denominator calculate, like this:

DIVIDE (
    CALCULATE (
        SUM ( 'DATA'[Weight] ),
        FILTER (
            'DATA',
            'DATA'[XXX] = "Yes"
                && 'DATA'[Age] = [Selected_Age]
                && 'DATA'[Gender] = [Selected_Gender]
        )
    ),
    CALCULATE (
        SUM ( 'DATA'[Weight] ),
        ALLEXCEPT ( 'DATA', 'DATA'[Year], 'DATA'[Age], 'DATA'[Gender] ),
        DATA[XXX] <> "."
    )
)


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

Thank you! This is very helpful!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

hello, 

 

this solution of removing missing in calculate function (dax) doesn't seem to work for me. Perhap because the calculate is based on other measures which already have filter in them. I ended up just using simple If(isblank(variable), blank(), calculate(variable - variable2).

Stachu
Community Champion
Community Champion

add the 

DATA[XXX]<>"."

to your denominator calculate, like this:

DIVIDE (
    CALCULATE (
        SUM ( 'DATA'[Weight] ),
        FILTER (
            'DATA',
            'DATA'[XXX] = "Yes"
                && 'DATA'[Age] = [Selected_Age]
                && 'DATA'[Gender] = [Selected_Gender]
        )
    ),
    CALCULATE (
        SUM ( 'DATA'[Weight] ),
        ALLEXCEPT ( 'DATA', 'DATA'[Year], 'DATA'[Age], 'DATA'[Gender] ),
        DATA[XXX] <> "."
    )
)


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Thank you! This is very helpful!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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