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

How to calculate avg of a column (number) then return it based on conditions (text)

Would like to calculate the average of a column ("Score") then return it based on conditions (text).

 

Score
1
5
7
9
10

3

 

The average would be 5.8333

 

However, would like it to refer to the rating_criteria info (below)

 Rating_Criteria
8.1 to 10World Class
7.6 - 8.0Excellent
7.1 - 7.5Good
6.5 - 7.0Average
1.0 - 6.4Under-performing

 

and return as per the criteria which to show "Under-Performing"  please 🙂 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

maybe you can try this

Measure = 
VAR _avg=AVERAGE('Table'[Score])
return SWITCH(TRUE(),_avg>8.1,"world class",_avg>7.5,"Excellent",_avg>7.0,"Good",_avg>6.4,"Average","Under-performing")

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

Excel formlua is concise enough to cope with this,

Screenshot 2021-09-23 033652.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

ryan_mayu
Super User
Super User

@Anonymous 

maybe you can try this

Measure = 
VAR _avg=AVERAGE('Table'[Score])
return SWITCH(TRUE(),_avg>8.1,"world class",_avg>7.5,"Excellent",_avg>7.0,"Good",_avg>6.4,"Average","Under-performing")

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Worked like a charm! 
Thank you 

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.