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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Cednok
Frequent Visitor

Exclude duplicate reference from a calculation

Hello the Community,

 

I have to calculate a percentage of anomaly on the sales of some product.
On the file of anomaly my problem is that I have several type of anomaly on the same reference so on a reference the anomaly is counted several times.

 

Cednok_0-1622641761674.png


How to make sure that if a reference is present several times, only one is counted in the calculation?

 

Thanks in advance

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

Hi @Cednok ,  

In my understanding, You could create a measure by the following formula:

anomaly  percentage = DISTINCTCOUNT([REF])/CALCULATE(COUNT([REF]),FILTER(ALL('Table'),[Article Type]="Sold to"))

 

The final output is shown below:  

v-yalanwu-msft_0-1622799458489.png

If it is incorrect, you could try to another measure by the following formula:

anomaly  percentage2 = DISTINCTCOUNT([REF])/COUNT([REF])

The final output is shown below:  

v-yalanwu-msft_1-1622799458492.png

Best Regards,
Community Support Team_ Yalan Wu
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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi @Cednok ,  

In my understanding, You could create a measure by the following formula:

anomaly  percentage = DISTINCTCOUNT([REF])/CALCULATE(COUNT([REF]),FILTER(ALL('Table'),[Article Type]="Sold to"))

 

The final output is shown below:  

v-yalanwu-msft_0-1622799458489.png

If it is incorrect, you could try to another measure by the following formula:

anomaly  percentage2 = DISTINCTCOUNT([REF])/COUNT([REF])

The final output is shown below:  

v-yalanwu-msft_1-1622799458492.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you very much

amitchandak
Super User
Super User

@Cednok ,

Try like (measure)

 

countrows(summarize(Table, Table[ref]))

 

Distinctcount(Table[Ref])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you but these measurs will tell me how many duplicate references I have, it will not allow me to do the calculation

 

I may have badly expressed my need

 

I have to calculate a percentage of anomaly on the reference of articles but I have several anomalies on the same references.

But if several anomalies on the same reference = 1 anomaly
For example on the file I should have 8 real anomaly

For examples At the moment I have 10 articles "sold to", on the file anomaly you can see 5 anomalies but on 3 references the calculation should be 3/10 and not 5/10

 

How to make so that the calculation is taken into account only on the distinct references ?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

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

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.