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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
sv98917n
Helper I
Helper I

Flag Duplicates as Yes/No, But Not Including Blanks

Hello Everyone, 

 

I am trying to flag duplicate values with the following measure since I need it do work with my page filters: 

 

Critical Segment ID (Y/N) = IF (COUNTROWS ( FILTER ( allselected(Table1), Table1[SEGMENT_ID] = MAX( Table1[SEGMENT_ID] ) ) ) >=2, "YES", "NO" )
 
My only problem is that it is flagging my blank segment IDs as a duplicate and returning "Yes."
 
Anyway for it to ignore the blanks?
 
Thank you! 
1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @sv98917n ,

 

Filter blank value before count rows, check the formula below.

Column =
VAR countid =
    CALCULATE (
        COUNTROWS ( FILTER ( 'Table', 'Table'[value] <> BLANK () ) ),
        ALLEXCEPT ( 'Table', 'Table'[id] )
    )
RETURN
    IF ( countid > 1, "yes", "no" )

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @sv98917n ,

 

Filter blank value before count rows, check the formula below.

Column =
VAR countid =
    CALCULATE (
        COUNTROWS ( FILTER ( 'Table', 'Table'[value] <> BLANK () ) ),
        ALLEXCEPT ( 'Table', 'Table'[id] )
    )
RETURN
    IF ( countid > 1, "yes", "no" )

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@sv98917n , Try like

 

Critical Segment ID (Y/N) = IF (COUNTROWS ( FILTER ( allselected(Table1), Table1[SEGMENT_ID] = MAX( Table1[SEGMENT_ID] ) ) ) >=2 && not(isblank(Table1[SEGMENT_ID])), "YES", "NO" )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

It won't let me use the column [SEGMENT_ID] after the not(isblank at the end. Says that has to be a measure in order to work. 

darentengmfs
Post Prodigy
Post Prodigy

Hi @sv98917n 

 

Try adding ISBLANK() in your formula

 

IF(ISBLANK(Table1[SEGMENT_ID]), "No"),IF (COUNTROWS ( FILTER ( allselected(Table1), Table1[SEGMENT_ID] = MAX( Table1[SEGMENT_ID] ) ) ) >=2, "YES", "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.

Top Kudoed Authors