Forum Discussion
Help needed with DistinctCount & Average
Thank you very much for your help!
I seem to have this as an error
"The column 'ClientCategory[Category]' either doesn't exist or doesn't have a relationship to any table available in the current context."
Anything that I should be looking out for?
Hi,
Check the table name, I used a slightly different one than the one in your example. (Client Table -> ClientCategory). Additionally, I had a relationship between the Sales and client table.
- ngiam4 years agoHelper I
Thank you ValtteriN,
Am using the right table. Do many-many relationship has any impact to this?
Thanks!
- ValtteriN4 years agoCommunity Champion
Yeah, M:N will break RELATED. Here is a formula that works with that relation:
AverageTest =calculate(DISTINCTCOUNT(Sales[Employee Name]),filter(Sales,AVERAGEX(SUMMARIZE(filter(Sales,Sales[Client] in SUMMARIZE(FILTER('ClientCategory',ClientCategory[Category]="Main"),ClientCategory[Client])),Sales[Employee Name],Sales[Client],"AV",AVERAGE(Sales[Sales ])),Sales[Sales ])<100))- ngiam4 years agoHelper I
Thank you! This seems to work!
That said, it seems to work well for non-decimal numbers and doesn't seems to be workable for number with decimal. Is there a way to enable average of numbers with decimal?