Search code examples
powerbidaxdata-analysispowerbi-desktopmeasure

Create a Power BI Measure that counts rows based on values in two columns


Very new to Power BI and DAX in particular so this is a pretty basic question...

I would like to create Cards that count the rows in my table that meet criteria across multiple columns. I think creating Measures is the best way to do this, so that is what I have been trying.

In this example it is two columns but I would like to understand how to do it across multiple columns...

Example:

Col A          Col B            Col C

Alexandra      Not Started      
Joe            Complete         Yes
Tom            Complete
Frank          Not Started      Yes
Pam            Not Started      Yes
Camilla        Complete

I want my card to give the number of rows where Col B is 'Not Started' and Col C is 'Yes'. So in the above example, the count would be '2'

I have tried to create a measure using the below but it isn't working:

Count of Not Started and Yes = 

CALCULATE(COUNTA([Col A]), [Col B] IN {"Not Started"}+ [Col C] IN {"Yes"} )

Solution

  • this should work

    result= 
        CALCULATE(
            COUNTROWS('Table'),
            'Table'[Col B] = "Not Started",
            'Table'[Col C] = "Yes"
        )