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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
pbiuser452
Regular Visitor

Remove Duplicates only if value is 0 in other column

Hey Everyone,

 

I have a table that I need to remove duplicates on. The Column I need to use is an ID number of the user. I need to remove the duplicate if the ID is a duplicate of another ID, but only remove the row if the value in a different column is 0.

 

For example:

 

ID numberOther Value
00000014
00000010
00002005
00002002

 

I only want to remove the '0000001' duplicate where the other value is 0, but keep the '0000200' duplicates since both of the other value's are not 0. 

 

Please let me know if I need to clarify anything!

1 ACCEPTED SOLUTION

Thank you, this helps a ton! I ended up finding out that the data was bad and built a new query to capture the correct data. Thank you so much for your help!

View solution in original post

4 REPLIES 4
v-chenwuz-msft
Community Support
Community Support

Hi pbiuser452,

 

In another word, you want to remove duplicates rows with 0.

This my original data:

 

vchenwuzmsft_0-1630287035839.png

 

1 Create a new column

New column =

var countID = CALCULATE(COUNTROWS('TABLE'),FILTER('TABLE',EARLIER('TABLE'[ID number])='TABLE'[ID number]))

var sumValue = CALCULATE(sum('TABLE'[Other Value]),FILTER('TABLE',EARLIER('TABLE'[ID number])='TABLE'[ID number]))

return

If(sumValue=0 && countid>1,1,IF(countID>1 && [Other Value]=0,0,2))

2 Then drag all the fields you need to the table visual and put New column to the filters on this visual.

3 Set Other Value’s feature Don’t summarize

vchenwuzmsft_1-1630287035840.png

 

4 Then set the filter’s value is greater then 0.

vchenwuzmsft_2-1630287035842.png

 

And the result:

vchenwuzmsft_3-1630287035844.png

 

Best Regards

Community Support Team _ chenwu zhu

 

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

 

Thank you, this helps a ton! I ended up finding out that the data was bad and built a new query to capture the correct data. Thank you so much for your help!

PaulDBrown
Community Champion
Community Champion

Try:

First create a measure for the sum of Other Value = SUM(table[Other Value])

then

Remove duplicates with 0 =
VAR IDs = VALUES(table[Id number])

VAR Zero = CALCULATETABLE( VALUES(table [Id number]), FILTER(table, [Sum Other Value] = 0))

RETURN

COUNTROWS( EXCEPT(IDs, Zero))

 

now create a visual with the Ids and add the measure to the filters in the filter pane and set the value =1





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thank you, this helps a ton! I ended up finding out that the data was bad and built a new query to capture the correct data. Thank you so much for your help!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.