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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Me7sin
New Member

find duplication based on if condition

Greetings,
In my data I have IDs in a column that can be dublicated and status (open or closed) for these IDs. I need to create another column "called varify" to check if all cases belong to that IDs is closed or not, if at least one of the status is not closed, then all should be open.

Current table

Me7sin_0-1709201940924.png

Target table

Me7sin_1-1709202183795.png

from the target table, ID 100001 is still open since two (key 3 and 4 ) are open

1 ACCEPTED SOLUTION
v-tianyich-msft
Community Support
Community Support

Hi @Me7sin ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1709272539040.png

_True = IF(MAX('Table'[Status])="Open",1,0)

Varify = var _t = ADDCOLUMNS('Table',"Varify",IF(MAXX(FILTER(ALL('Table'),[ID]=EARLIER([ID])),[_True])=1,"Open","Closed"))
RETURN MAXX(_t,[Varify])

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

View solution in original post

2 REPLIES 2
v-tianyich-msft
Community Support
Community Support

Hi @Me7sin ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1709272539040.png

_True = IF(MAX('Table'[Status])="Open",1,0)

Varify = var _t = ADDCOLUMNS('Table',"Varify",IF(MAXX(FILTER(ALL('Table'),[ID]=EARLIER([ID])),[_True])=1,"Open","Closed"))
RETURN MAXX(_t,[Varify])

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

amitchandak
Super User
Super User

@Me7sin , No need of  table, a new column can do 

 

New column

var _t = countx(filter(Table, [ID] = earlier([ID]) ), [ID] )

var _c = countx(filter(Table, [ID] = earlier([ID]) && [Status] = "closed" ), [ID] )

return

if(_t =_c , "Closed", "Open")

 

In visual you can display the new column

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

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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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