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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
SDVN
Helper I
Helper I

Writing a measure to get a single value for repeated rows.

I want to create a table visual in power BI: subject_id as the first column and "yes/no" column next to it. But each subject has multiple entries(rows) and some rows will have "closed" in the "Yes/no" column and some rows might have "Opened" for a single subject. I want to show only one row per subject id in the table visual and if that sublect has only "Closed" in Yes/no column, the it should be "Closed", if there is a single "Opened" for that subject, it should be "Opened" in the table visual. 

Its more like students pass/fail logic. If the student is passed in all the subject, the status should be "Passed" and if that student is failed in one of the subjects, the status should be "Failed" even though he/she has passed few subjects.

 

I wrote a function:

 

IF(    COUNTROWS(FILTER(mytable, mytable[Yes/No] = "Opened")) > 0,    "Opened",    "Closed")

But in the table visual, its giving all the rows of every subject and not just one row per subject as per the above explained logic. Yes_no.png 

1 ACCEPTED SOLUTION
nilendraFabric
Community Champion
Community Champion

 

try this

 


Status =
IF (
CALCULATE (
COUNTA ( mytable[Yes/No] ),
FILTER ( mytable, mytable[Yes/No] = "Opened" )
) >= 1,
"Opened",
"Closed"
)

View solution in original post

2 REPLIES 2
SDVN
Helper I
Helper I

Thank you sir! Very helpful! 

nilendraFabric
Community Champion
Community Champion

 

try this

 


Status =
IF (
CALCULATE (
COUNTA ( mytable[Yes/No] ),
FILTER ( mytable, mytable[Yes/No] = "Opened" )
) >= 1,
"Opened",
"Closed"
)

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors