The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
25 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
31 | |
10 | |
10 | |
10 | |
9 |