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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
hpatel24779
Helper II
Helper II

How to display Yes if condition matches for all duplicate ids

Hi all,

 

reposting this as solution given is not what is intended.

 

I need some help to figure this out. in my table, i have ID and Step Type. Each id can have multiple steps. i want to show yes for each duplicate id if it matches my condition. for example i have the following:

IDStep Type
1

A

1C
2F
3B
3C
4C

 

I want to add a column that if step = C then it shows "yes" for each ID and "No" if it doesn't.

 

Expected result should look like this:

 

IDStep TypeResult
1AYes
1CYes
2FNo
3BYes
3CYes
4CYes

 

Can someone please help with this. Please note, if there is only 1 id and step type = C then it should also show Yes

 

Thanks

Hetal

1 ACCEPTED SOLUTION
Bibiano_Geraldo
Super User
Super User

Hi @hpatel24779 ,

You can achieve your goal by this measure using DAX:

Result = 
IF(
    CALCULATE(
        COUNTROWS(TableName),
        TableName[Step Type] = "C",
        ALLEXCEPT(TableName, TableName[ID])
    ) > 0,
    "Yes",
    "No"
)

 

Now your Matrix should look like this:

Bibiano_Geraldo_0-1732278630118.png

 

 

 

View solution in original post

5 REPLIES 5
Bibiano_Geraldo
Super User
Super User

Hi @hpatel24779 ,

You can achieve your goal by this measure using DAX:

Result = 
IF(
    CALCULATE(
        COUNTROWS(TableName),
        TableName[Step Type] = "C",
        ALLEXCEPT(TableName, TableName[ID])
    ) > 0,
    "Yes",
    "No"
)

 

Now your Matrix should look like this:

Bibiano_Geraldo_0-1732278630118.png

 

 

 

thank you so much @Bibiano_Geraldo this is what i needed

Hi @hpatel24779 , Happy it worked.


johnt75
Super User
Super User

You can use

Includes step C = 
VAR AllSteps =
    CALCULATETABLE ( VALUES ( 'Table'[Step Type] ), REMOVEFILTERS ( 'Table'[Step Type] ) )
VAR Result =
    IF ( "C" IN AllSteps, "Yes", "No" )
RETURN
    Result
ribisht17
Super User
Super User

@hpatel24779 

 

Use this DAX

Check Dup =

            CALCULATE(COUNT(Q1_Duplicate[Step Type]),Q1_Duplicate[ID]=EARLIER(Q1_Duplicate[ID]),all(Q1_Duplicate))
 
 
 
 
ribisht17_0-1732278560026.png
Check Dup =

           var cnt= CALCULATE(COUNT(Q1_Duplicate[Step Type]),Q1_Duplicate[ID]=EARLIER(Q1_Duplicate[ID]),all(Q1_Duplicate))

         

           var t_f =IF(cnt>1,1, if(Q1_Duplicate[Step Type]="C",1,0))

           RETURN

           IF(t_f=1,1,0)
 
 
 
 
For Yes and No format please use
Check Dup =

           var cnt= CALCULATE(COUNT(Q1_Duplicate[Step Type]),Q1_Duplicate[ID]=EARLIER(Q1_Duplicate[ID]),all(Q1_Duplicate))

         

           var t_f =IF(cnt>1,1, if(Q1_Duplicate[Step Type]="C",1,0))

           RETURN

           IF(t_f=1,"Yes","No")
 
 
ribisht17_1-1732279359147.png

 

Regards,
Ritesh

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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