Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count ( ) on a measure

Hello,

 

My dataset is the following : 

 

Each people has 1 row for 1 month with a score  (    Month |  Name  |   score    ).

 

I have the report below : It matches a name and  his average score

 

Hologanpa_0-1602404965261.png

 

The following measure allow me to sort people in the right section, even if I select several months : 

 

Measure = IF(AVERAGE([score])==BLANK(),"ABS",
  IF(AVERAGE([score])<80,"<80",                                                                                                             IF(AND(AVERAGE([score])>79,AVERAGE([score]<90),"89-80",                                                   IF(AND(AVERAGE([score])>88,AVERAGE([score])<93),"92-89",">92")   )   )   )
 
 

Here is my problem : 

 

I'd like to get the number of people in each category. 

Ideally I'd like to get it through a piechart , but the thing is I can't use a measure as a  Legend / Category.

 

 I created a column using the same Dax expression without Average

Capture2.PNG

 
It works well if I select 1 month. But if  I select 2 months then it counts the number of people who has been in this category , when I need the number of people in the category after the average of selected month
 
Also I tried that : 
 
test = CALCULATE(DISTINCTCOUNT(Data[Name]),FILTER(Data,measure=">92"))
 
But it returns me the same result ...
 
 
Any idea of how to get the number of people having an average score of >92   between January and february for exemple ?
I will let down the piechart for Card visualization  I guess .
 
 
TIA  🙂
 
 
2 REPLIES 2
lbendlin
Super User
Super User

There are a number of considerations here.

 

1. Does it have to be a measure?

2. Will you ever only want to categorize by month or will there be other filter scenarios too?

 

Basically in your measure you need to compute the score for each technician for each filter category (eg each month)  and then add additional logic to see if they consistently fall into the same category or not.  Let's say a technician has a score of 92 in January but of 80 in February. Which bucket should the go into?

 

By the way you can simplify your original measure

 

Measure = SWITCH(TRUE()
,[score]==BLANK(),"ABS"
,AVERAGE([score])<80,"<80"
,AVERAGE([score])<90,"89-80"
,AVERAGE([score])<93,"92-89"
,">92"
)
Anonymous
Not applicable

Hello   , 

 

I thought I answered but I don't see my message ... 

 

I guess it should be a measure since I need to dynamically match people and category ( even If severals month are selected ).

 

Thank for the tip ! I 'm not very familiar with SWITCH statement, but it seems very usefull  each time I meet it 😀

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.