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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
hpatel24779
Helper II
Helper II

For each duplicate id, show yes if it matches condition

Hi all,

 

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

 

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

 

Can someone please help with this.

 

Thanks

Hetal

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @hpatel24779 
You can use DAX formula:

Flag =
var Occurrences =
CALCULATE(
    COUNTROWS('Table'),
    FILTER('Table', 'Table'[ID] = EARLIER('Table'[ID]))
)
RETURN
if(Occurrences>1, "Yes","No")
Ritaf1983_0-1732272619481.png

The pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

7 REPLIES 7
Ritaf1983
Super User
Super User

Hi @hpatel24779 
You can use DAX formula:

Flag =
var Occurrences =
CALCULATE(
    COUNTROWS('Table'),
    FILTER('Table', 'Table'[ID] = EARLIER('Table'[ID]))
)
RETURN
if(Occurrences>1, "Yes","No")
Ritaf1983_0-1732272619481.png

The pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

thank you so much @Ritaf1983 

 

this is exactly what i was after. much appreciated

Hi @hpatel24779 

Did you download the PBIX file I attached and try to compare it with what you're doing?
If not, it's worth downloading and checking.
If you did, and it’s not working, it probably means the script is not exactly as described in the question.
Please save your PBIX file to some public cloud and share it via a link, excluding sensitive data.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Sorry jumped the gun, this is actually not working as intended

Kedar_Pande
Super User
Super User

@hpatel24779 

Create a calculated column

Result = 
IF(
CALCULATE(
COUNTROWS(FILTER('Table', 'Table'[ID] = EARLIER('Table'[ID]) && 'Table'[Step Type] = "C")),
ALLEXCEPT('Table', 'Table'[ID])
) > 0,
"Yes",
"No"
)

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

Hi @Kedar_Pande, i tried your method but when entering the line countrows(filter('Table','Table'[ID] = Earlier('Table'[ID], i don't see the table after earlier( if this makes sense?

Please share a simplified version of your PBIX file (in English) without sensitive data. You can upload it to a public cloud service like OneDrive, Google Drive, or Dropbox and share the link. This will help in understanding your data structure and the issue, allowing for more precise guidance.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors