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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors