8 Replies Latest reply on Jan 3, 2017 10:34 AM by Marcelo Montu

# Pie chart percentage from two summed categories

I'm trying to create a pie chart which displays the ratio between two fields.
By following the steps on Pie Chart from two summed categories? I was able to create a chart, but the ratio is displayed incorrectly.

For instance, in the image below I expected that nearly half of the pie would be orange, given that the ratio is 50/93:

• ###### 1. Re: Pie chart percentage from two summed categories

Hi Marcelo,

Find my approach as reference below and stored in attached workbook version 9.3

• ###### 2. Re: Pie chart percentage from two summed categories

You used the same approach, and your result shows the same problem. I'm looking for a way to display a ratio of those two fields.

Using my data the ratio is 50/93 = 0.53, so I expected half of the pie orange, not only one third.

With your data, the case to alert ratio is 50/43 = 1.16 or 116%, so I expected the pie to be completely orange.

Is there any other approach to displaying the ratio between to measures in a pie chart?

• ###### 3. Re: Pie chart percentage from two summed categories

Hi Marcelo

In my scenario Case has the colour green

When I "hover" over the green part (>50%) it gives me Case 50

When I "hover" over the orange part (<50%) it gives met Alert 43

PS your approach is "slighthly" different to my approach

Your "Measure Values" is 143 mine is 93

Your "Measure Values" are AGG(XXX) mine SUM(XXX)

• ###### 4. Re: Pie chart percentage from two summed categories

Hi Marcelo,

Is that what you wanted?

Create a cacl field using below mentioned formula. Then drag the field as per above instructions.

IF ATTR([status])='Case' THEN SUM([Number of Records])/TOTAL(SUM([Number of Records]))

ELSEIF

ATTR([status])='Alert' THEN SUM([Number of Records])/TOTAL(SUM([Number of Records]))

END

Compute using Status.

Let me know If this help.

Mahfooj

1 of 2 people found this helpful
• ###### 5. Re: Pie chart percentage from two summed categories

Hi Marcelo,

I don't think the 'Alert' and 'Case' measures are necessary here. Instead, I'm using the 'Number of Records' and then add a quick table calculation 'Percent of Total' to the label.

Please let me know if it helps.

Thanks,

Jiayi

1 of 2 people found this helpful
• ###### 6. Re: Pie chart percentage from two summed categories

Thanks for your reply, Mahfooj! Your approach is interesting, but I don't know how I could apply it to my problem, given that the two measures aren't related; they are two COUNTD on two measures.

• ###### 7. Re: Pie chart percentage from two summed categories

Thanks for your reply, Jiayi! Your approach is interesting, but I don't know how I could apply it to my problem, given that the two measures aren't related; they are COUNTD on two measures. I don't have anything similar to the 'status' you applied to the color shelf, and I'm not sure how I could filter the 'number of records' to count only the two relevant measures.

• ###### 8. Re: Pie chart percentage from two summed categories

In case anyone else has the same problem:

1. create a calculated field named 'ratio' for the percentage: COUNTD([Case Id])/COUNTD([Alert Id])
2. create another calculated field named 'complement' for the complementary percentage: 1 - [ratio]
3. drag 'Measure Values' to the Size shelf and remove all but the two field created above
4. drag 'Measure Names' to the Color shelf