Forum Discussion
Use DISTINCTCOUNT in a GROUPBY expression
Hello! I've been trying to create a GROUPBY expression and one of the columns should be a DISTINCTCOUNT expression for the given group. However I get a message saying something like "CURRENTGROUP must be used...". The DISTINCTCOUNT funciton takes only column name.
So, how do I create a DISTINCTCOUNT column in a GROUPBY function?
Thanks!
Gorgi.
Anonymous
If you want to "get distinct ItemId per area and then average that" then I would suggest something like this:
Average Distinct Items by Area = AVERAGEX ( VALUES ( Sheet1[AreaId] ), CALCULATE ( DISTINCTCOUNT ( Sheet1[ItemId] ) ) )
11 Replies
- parry2kSuper User
can you post sample data with expected result, it will help :)
- AnonymousNot applicable
Here's an example: https://www.dropbox.com/s/aszcfyjm0r5zn7a/Example.pbix?dl=0
Check the measure. I want to include the DISTINCTCOUNT of AreaId column and average on it.
Thanks for your help parry2k !
- Ashish_MathurSuper User
Hi,
Please explain the question is simple non technical language. What exactly are you trying to compute?