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
MartinLucas
Frequent Visitor

Counting number of distinct values by date

I'm trying to calculate the number of distinct values in a column by dates.

When trying to use DISTINCTCOUNT, it seems to count the number of occurrences for each distinct value, which isn't what I'm looking for.

 

My data looks like this, and I'd like to calculate the "Amount" column

 WorkerAmount
01-aprA3
01-aprA3
01-aprA3
01-aprB3
01-aprB3
01-aprB3
01-aprB3
01-aprC3
01-aprC3
01-aprC3
01-aprC3
02-aprA4
02-aprA4
02-aprA4
02-aprB4
02-aprB4
02-aprC4
02-aprC4
02-aprC4
02-aprC4
02-aprD4
02-aprD4
02-aprD4
02-aprD4
02-aprD4

 

Does anyone know how to do this?

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @MartinLucas

 

Add index column:

= Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)

Try measure as:

 

Measure = 
CALCULATE(
    DISTINCTCOUNT('Table'[Worker]),
    FILTER(
        ALL('Table'),
        'Table'[Date]=MAX('Table'[Date])
    )
)

 

Here is the output:

v-xulin-mstf_1-1617952814766.png

 

The pbix file is attached.

 

Best Regards,

Link

 

View solution in original post

2 REPLIES 2
v-xulin-mstf
Community Support
Community Support

Hi @MartinLucas

 

Add index column:

= Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)

Try measure as:

 

Measure = 
CALCULATE(
    DISTINCTCOUNT('Table'[Worker]),
    FILTER(
        ALL('Table'),
        'Table'[Date]=MAX('Table'[Date])
    )
)

 

Here is the output:

v-xulin-mstf_1-1617952814766.png

 

The pbix file is attached.

 

Best Regards,

Link

 

amitchandak
Super User
Super User

@MartinLucas , Try a measure like

countrows(summarize(Table, Table[date], Table[Amount]))

 

or

 

countrows(summarize(Table, Table[date], Table[Worker], Table[Amount]))

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors