Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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 |
---|---|
16 | |
15 | |
14 | |
12 | |
11 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
9 |