Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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
| Worker | Amount | |
| 01-apr | A | 3 |
| 01-apr | A | 3 |
| 01-apr | A | 3 |
| 01-apr | B | 3 |
| 01-apr | B | 3 |
| 01-apr | B | 3 |
| 01-apr | B | 3 |
| 01-apr | C | 3 |
| 01-apr | C | 3 |
| 01-apr | C | 3 |
| 01-apr | C | 3 |
| 02-apr | A | 4 |
| 02-apr | A | 4 |
| 02-apr | A | 4 |
| 02-apr | B | 4 |
| 02-apr | B | 4 |
| 02-apr | C | 4 |
| 02-apr | C | 4 |
| 02-apr | C | 4 |
| 02-apr | C | 4 |
| 02-apr | D | 4 |
| 02-apr | D | 4 |
| 02-apr | D | 4 |
| 02-apr | D | 4 |
| 02-apr | D | 4 |
Does anyone know how to do this?
Solved! Go to Solution.
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:
The pbix file is attached.
Best Regards,
Link
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:
The pbix file is attached.
Best Regards,
Link
@MartinLucas , Try a measure like
countrows(summarize(Table, Table[date], Table[Amount]))
or
countrows(summarize(Table, Table[date], Table[Worker], Table[Amount]))
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 70 | |
| 50 | |
| 42 | |
| 40 |