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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
EmilyM2019
Helper II
Helper II

DAX to get a % based on non blanks

Hi all,

 

I currently have the below measure to calulate the % of Yes's within a column, the DAX for this I am uing is:

 

DIVIDE(CALCULATE(COUNTROWS('Psych data'),'Psych data'[Appointment required] = "Yes"), CALCULATE(COUNTROWS('Psych data')))
 
The problem is my column 'Appoinment required' contains Yes, No and Blanks. How do I get it to exclude the blanks so the % is being calculated just on the rows with Yes and No?
 
Any help would be appreciated.
 
Regards,
 
Emily.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

[Measure] =
CALCULATE(
    DIVIDE(
        CALCULATE(
            COUNTROWS( 'Psych data' ),
            KEEPFILTERS(
                'Psych data'[Appointment required] = "Yes"
            )
        ),
        COUNTROWS( 'Psych data' )
    ),
    KEEPFILTERS(
        NOT ISBLANK( 'Psych data'[Appointment required] ) 
    )
)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

[Measure] =
CALCULATE(
    DIVIDE(
        CALCULATE(
            COUNTROWS( 'Psych data' ),
            KEEPFILTERS(
                'Psych data'[Appointment required] = "Yes"
            )
        ),
        COUNTROWS( 'Psych data' )
    ),
    KEEPFILTERS(
        NOT ISBLANK( 'Psych data'[Appointment required] ) 
    )
)
Jihwan_Kim
Super User
Super User

Hi, @EmilyM2019 

In my case, I use countblank ( column name) function and subtract from it.

 

https://docs.microsoft.com/en-us/dax/countblank-function-da

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors