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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Unique count

IDDesired Output
7011
7010
7031
7021
7020
7030
7020

Need Help to find out duplicate

1 ACCEPTED SOLUTION

@Anonymous 

please try below formula.

Column = 
VAR _count= CALCULATE(COUNTROWS(Sheet7),FILTER(Sheet7,Sheet7[ID]=EARLIER(Sheet7[ID])&&Sheet7[Index]>=EARLIER(Sheet7[Index])))
VAR _count2=CALCULATE(COUNTROWS(Sheet7),FILTER(Sheet7,Sheet7[ID]=EARLIER(Sheet7[ID])))
return if(_count=_count2,1,0)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

@Anonymous 

 

If we understanding is correct, please try below steps.

 

1. create an index column.

2. try to create a column

Column = 
VAR _count= CALCULATE(COUNTROWS(Sheet7),FILTER(Sheet7,Sheet7[ID]=EARLIER(Sheet7[ID])&&Sheet7[Index]>=EARLIER(Sheet7[Index])))
return if(_count>1,1,0)

1.PNG

Hope this is helpful.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ryan_mayu
Super User
Super User

@Anonymous 

 

could please explain the logic of the output?

if found duplicated ,then output 1?

Should the second 702 be 1 because the last line is also 702?

 

IDDesired Output
7011
7010
7031
7021
7021
7030
7020




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

IDDesired Output
7011
7010
7031
7021
7020
7030
7020

 

If id occuring 2nd time  or more than 1st time than output to be 0 

dax
Community Support
Community Support

Hi @Anonymous ,

You also could try below M code 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjcwVIrVQaaNobQRGo0kHgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [ID = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"all", each _, type table [ID=number, Desired Output=number]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([all],"index",1,1)),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"index"}, {"index"}),
    #"Replaced Value" = Table.ReplaceValue(#"Expanded Custom",each [index],each if [index]=1 then 1 else 0,Replacer.ReplaceValue,{"index"}),
    #"Removed Columns" = Table.RemoveColumns(#"Replaced Value",{"all"})
in
    #"Removed Columns"

Best Regards,
Zoe Zhi

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

 

@Anonymous 

please try below formula.

Column = 
VAR _count= CALCULATE(COUNTROWS(Sheet7),FILTER(Sheet7,Sheet7[ID]=EARLIER(Sheet7[ID])&&Sheet7[Index]>=EARLIER(Sheet7[Index])))
VAR _count2=CALCULATE(COUNTROWS(Sheet7),FILTER(Sheet7,Sheet7[ID]=EARLIER(Sheet7[ID])))
return if(_count=_count2,1,0)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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