The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. 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 |
---|---|
14 | |
11 | |
8 | |
7 | |
7 |
User | Count |
---|---|
21 | |
20 | |
12 | |
11 | |
7 |