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

Percentage based bar chart?

 

I would like to make bar chart where customersatisfaction is based on percentage so that it is scaled based on max value.

So Toyota have 100% satisfaction and Nissan 50%. 

 

CustomerName, TimeStamp, CustomerSatisfaction

Nissan, 2016-12-1, 65

Toyota, 2016-12-1, 130

 

How to do?

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

I have tested it on my side, your formula works fine for me. Note: make sure you have change the Type of Y-Axis to Categorital in Format tab for the bar Chart.Smiley Happy

 

r1.PNG

Here is the sample pbix file for your reference.

 

Regards

View solution in original post

5 REPLIES 5
Thiyags
Helper II
Helper II

You have to create 2 measures . 1 measure to find the max value and 2 nd measure to divide with the max value

 

1. MaxCustomer Satisfaction = CALCULATE(MAX(CS[Customer Satisfaction]),ALL(CS[Customer Name]))

 

2. CustomerSatisfactionPercentage = DIVIDE(SUM(CS[Customer Satisfaction]),[MaxCustomerSatisfaction])

Anonymous
Not applicable

I tried, but not looking good.

 

Is it so that purpose of MaxCustomerSatisfaction is add value "130" to each row as reference value? (basically highest value of all)

And is it so that purpose of CustomerSatisfactionpercentage is show percentage of the row compared to MaxCustomerSatisfaction like 100% or 50%

 

What I see is that MaxCustomerSatisfaction value for each row is varying and highest value is 1.

Hi @Anonymous,

 

The formulas provided by Thiyags should work. You should use the formulas to create two measures instead of calculate column.

 

m1.PNGr1.PNG

 

Here is the sample pbix file for your reference.Smiley Happy

 

Regards

Anonymous
Not applicable

Sorry. You advice seems to be very correct. But could not apply as I used to simple scenario.

 

This is the real case.

 

emotionTable

PartitionKey, RowKey, Timestamp, Happiness

000000000001,1, 05/12/2016 13:01:01, 0,9999

000000000002,2, 05/12/2016 14:02:01, 0,0100

000000000003,3, 05/12/2016 15:03:01, 0,0001

000000000004,4, 05/12/2016 16:04:01, 0,0100

000000000005,5, 05/12/2016 16:05:01, 0,0001

000000000006,6, 06/12/2016 13:01:01, 0,0001

000000000007,7, 06/12/2016 13:02:01, 0,0200

000000000008,8, 06/12/2016 14:03:01, 0,0001

000000000009,9, 06/12/2016 14:04:01, 0,0300

0000000000010,10, 06/12/2016 13:04:01, 0,0100

 

Measures:

MaxHappiness = CALCULATE(MAX(emotionTable[Content.Happiness]),ALL(emotionTable[Timestamp]))

HappinessPercentage = DIVIDE(SUM(emotionTable[Content.Happiness]),[MaxHappiness])

 

I expected that all bar in chart in MaxHappines would be 0,999(row1) to be used as referenced value.

But what I see is all bars showing value 1.0. Obviouly something wrong with my MaxHappiness measure.

 

Target raports:

1) I see happiness percentage per timestamp. (Tells happiness by moment)

2) I see happiness average happiness percentage by hour. (I see happiness level by hour)

Hi @Anonymous,

 

I have tested it on my side, your formula works fine for me. Note: make sure you have change the Type of Y-Axis to Categorital in Format tab for the bar Chart.Smiley Happy

 

r1.PNG

Here is the sample pbix file for your reference.

 

Regards

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.