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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

DAX measure count duplicate column values on selection of columns

Hi, 

I need to count the number of duplicate 'Artikel' for every 'DC' and must use a DAX measure for this.


I have this table: 

DCRC CategoryRCArtikel Date
AIDdamagedappel2/01/2023 0:00
AIDdamagedpeer2/01/2023 0:00
AIDexpiredappel2/01/2023 0:00
AIDdamagedappel1/01/2023 0:00
AIDdamagedpeer1/01/2023 0:00
AIDexpiredappel1/01/2023 0:00
BIDdamagedappel1/01/2023 0:00
BUNIDdamagedbanaan1/01/2023 0:00
BIDexpiredbanaan1/01/2023 0:00
BIDexpiredpeer1/01/2023 0:00


I want to come to this result:

DCRC CategoryRCArtikel Measure
AIDdamagedappel2
AIDdamagedpeer1
AIDexpiredappel2
BIDdamagedappel1
BUNIDdamagedbanaan2
BIDexpiredbanaan2
BIDexpiredpeer1

 

I tried to use SUMMARIZE, ALLEXCEPT, CALCULATE, COUNT but can't figure it out....

 

Thanks for the help

Julie

3 REPLIES 3
Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _count1=
COUNTX(
    FILTER(ALL('Table'),
    'Table'[DC]=MAX('Table'[DC])&&'Table'[Artikel]=MAX('Table'[Artikel])),[Artikel])
var _count2=
CALCULATE(
    DISTINCTCOUNT('Table'[Date]),
    FILTER(ALL('Table'),
    'Table'[DC]=MAX('Table'[DC])&&'Table'[RC]=MAX('Table'[RC])))
return
DIVIDE(
    _count1,_count2)

2. Result:

vyangliumsft_0-1674107696017.png

 

Best Regards,

Liu Yang

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

@Anonymous , I am getting this with simple count. How you are getting value 2 for UNID ?

 

amitchandak_0-1674062390264.png

 

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

Hi @amitchandak ,

For value 'B' in column DC there are 2 'banaan' in column Artikel. I need to count the number of times one Artikel comes back in a DC. Regardless of the other selected columns.
Also the Date column is part of my datatable but in the table visual I dont included it so I dont wont it to affect the count (example Artikel 'Appel' in DC 'A' should return 2 in table visual and not 4).  

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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