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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Khushboo9966
Helper II
Helper II

How do I replace duplicates values with zero in a column based on other two columns.

Hi, 

 

I have three columns. I would like to keep only duplicate value and replace the others with zero. Is there a way to  accomplish that?

*Note: Count is calculated column. 

 

AuthorCount%Final outcome
Apple830%30%
Apple830%0%
Apple3740%40%
Apple3740%0%
Apple3740%0%
Boy210%10%
Boy210%0%
Boy210%0%
Boy210%0%

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@Khushboo9966

1.Add the index column to the powerquery:

vlinyulumsft_0-1719308389886.png

2.Create calculated column references:

Column = 
VAR FIRST=CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Author],'Table'[Count]))
RETURN IF('Table'[Index]=FIRST,'Table'[%],BLANK())
Column 2 = 
VAR CI='Table'[Author]
VAR ci2='Table'[Count]
VAR RANKC=RANKX(FILTER('Table','Table'[Author]=CI&&'Table'[Count]=ci2),'Table'[Index],,ASC,Dense)
RETURN IF(RANKC=1,'Table'[%],BLANK())

I've given you two options that you can choose according to your needs.

3.Here's my final result, which I hope meets your requirements.

vlinyulumsft_1-1719308435962.png

4.Here are some posts that are similar to your problem:

Solved: Group by ID Skip Aggregation - Microsoft Fabric Community

 

 

Please find the attached pbix relevant to the case.

 

If you have any other questions, please contact us.

Best Regards,

Leroy Lu

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
Anonymous
Not applicable

Hi,@Khushboo9966

1.Add the index column to the powerquery:

vlinyulumsft_0-1719308389886.png

2.Create calculated column references:

Column = 
VAR FIRST=CALCULATE(MIN('Table'[Index]),ALLEXCEPT('Table','Table'[Author],'Table'[Count]))
RETURN IF('Table'[Index]=FIRST,'Table'[%],BLANK())
Column 2 = 
VAR CI='Table'[Author]
VAR ci2='Table'[Count]
VAR RANKC=RANKX(FILTER('Table','Table'[Author]=CI&&'Table'[Count]=ci2),'Table'[Index],,ASC,Dense)
RETURN IF(RANKC=1,'Table'[%],BLANK())

I've given you two options that you can choose according to your needs.

3.Here's my final result, which I hope meets your requirements.

vlinyulumsft_1-1719308435962.png

4.Here are some posts that are similar to your problem:

Solved: Group by ID Skip Aggregation - Microsoft Fabric Community

 

 

Please find the attached pbix relevant to the case.

 

If you have any other questions, please contact us.

Best Regards,

Leroy Lu

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


 

Hi,

I am trying to use these formulas for power query, however, it keeps returning syntax errors. I think the issue I have is settign up the calculated column reference. I cannot use these formulas within a custom column field. 

Can you please explain how you are building this column?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.