cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ARomain
Helper I
Helper I

Count "No" cases when a Yes appears in the same column per unique ID

I am trying to figure out a measure to determine how many times a "No" answer appeared when a "Yes" answer appeared in the same column for the unique ID. I want to determine the values by the Name; San Francisco is not included in the values since there was not a "Yes" associated to that person.

 

image1.png

1 ACCEPTED SOLUTION
Barthel
Solution Sage
Solution Sage

Hey @ARomain,

Create a matrix in Power BI and place the locations in it. Then create the following measure that you can place in the matrix:

metric =
SUMX (
    KEEPFILTERS ( VALUES ( 'Table'[Name] ) ),
    VAR _name = 'Table'[Name]
    RETURN
        IF (
            CALCULATE (
                COUNTROWS ( 'Table' ),
                'Table'[Risidence] = "Yes",
                ALLSELECTED ( 'Table' ),
                'Table'[Name] = _name
            ) > 0,
            CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Risidence] = "No" )
        )
)

 

View solution in original post

1 REPLY 1
Barthel
Solution Sage
Solution Sage

Hey @ARomain,

Create a matrix in Power BI and place the locations in it. Then create the following measure that you can place in the matrix:

metric =
SUMX (
    KEEPFILTERS ( VALUES ( 'Table'[Name] ) ),
    VAR _name = 'Table'[Name]
    RETURN
        IF (
            CALCULATE (
                COUNTROWS ( 'Table' ),
                'Table'[Risidence] = "Yes",
                ALLSELECTED ( 'Table' ),
                'Table'[Name] = _name
            ) > 0,
            CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Risidence] = "No" )
        )
)

 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors