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
QuangMC
Frequent Visitor

Can you switch measure results dynamically

Hello all,

 

So i've had this question for a while now, but never got to find a correct way of doing this.

Context :

I have an "Evaluations" table, that has test results from multiple establishments.

I have to return the average results for each establishments.

The results are on a scale from 0 to 20.

Pretty easy so far.

 

Problem :

In a matrix visual, I need to show the average for each establishment, not as number, but as a letter.

For example, if the average of an establishment is 11 out 20, I need to show "C+". If the average is 17 out of 20, I need to show "A". And so on.

 

For now, I have had to do it all manually with multiple IF functions. It works, but this seems like a terrible solution, espacially if I have to had more IF later...

Isn't there any way to do this dynamically

 

So far, I have tried with less values, by first building a correspondance table like the following :

Possible_ResultsWhat_I_Want_To_See
1A
2B
3C

4

D

5

E

 

Then, I tried doing something like this in a measure :
If(

AVERAGE([Establishment_Result]) in [Possible_Results]

,[What_I_Want_To_See]

)

 

I also tried with SWITCH(), but it doesn't work. I haven't found any threads with similar problems, and I really can't think of anything alse I can try right now. Any clues would be appreciated !

 

Thank you in advance !

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@QuangMC ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

 

To me seem like a case of bucketing/ Dynamic segmentation

 

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@QuangMC ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

 

To me seem like a case of bucketing/ Dynamic segmentation

 

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

@amitchandak sorry, I just found my answer ^^'

 

I "just" needed to use a LOOKUPVALUE within my measure...

 

I tried to use the LOOKUPVALUE function before, but the results weren't what i expected. Turns out, it actually worked as intended, but my data quality was awful, and it ended in bad results.

 

This is actually pretty easy, I just ruled it out because I though it didn't work...

 

Sorry to have wasted your time ^^'

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.