Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi
How to calculate count distinct values based on max date column. I need count of all distinct id whoes date is max
Solved! Go to Solution.
Hi, @Sameer5858
You can try the following methods.
Sample data:
Measure:
Count = Var _maxdate=CALCULATE(MAX('Table'[Date]),ALL('Table'))
Return
CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),[Date]=_maxdate))
Is this the result you expect? If not, please provide some of the example data and desired results.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Sameer5858
You can try the following methods.
Sample data:
Measure:
Count = Var _maxdate=CALCULATE(MAX('Table'[Date]),ALL('Table'))
Return
CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),[Date]=_maxdate))
Is this the result you expect? If not, please provide some of the example data and desired results.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I would do something like this
Var maxDate = Max('YourFactTable'[DateColumn])
var result = calculate( DISTINCTCOUNT('YourFactTable'[IDColumn]), 'YourFactTable'[DateColumn]=maxDate)
return result
If this post was helpful, please kudos or accept the answer as a solution.
~ Anthony Genovese
Need more PBI help? PM me for affordable, dedicated training or consultant recomendations!
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |