8 Replies Latest reply on Dec 19, 2016 10:23 AM by Vishal Bhatia

# Need a help to create Pie Chart using measure

Hi,

I am trying to create a Pie chart without dimension (as not able to create field as dimension due to run time calculation) but unable to do so.

If you look at attached sheet, For "Data" tab I am able to populate the Pie chart but not for sheet4 as I am calculating Site wise count of Subject at run time and with this calculation I am getting my fields as measure not dimension. I need to showcase pie chart count in red and green where these values can be anything from parameter.

Country site Count  KPI (If Count>5 Then 'Red' Else 'Green')

========================================================

US            1       5         Green

US            2       9         Red

UK            3       4         Green

I have attached the workbook also for reference.

• ###### 1. Re: Need a help to create Pie Chart using measure

Not sure I really understand your question, but I know you can't compare a string to number. So it seems you've decided to count the string. But this will always give you only a single count and doesn't really accomplish what you seem to be wanting to do. Is this what you're looking for:

The formula: INT(MID([Subject No],2,10 )) > 3

strips the 'S' from the front of your sting, which produces a number value. Since it's now a number it can be compared to 3. The calc produces a boolean dimension that you can use to color your pie.

Is that what you wanted?

--Shawn

• ###### 2. Re: Need a help to create Pie Chart using measure

Thanks Shawn but I am looking for different solution where my count will be based on counting of Subject No site wise.

I will have site wise Subject count and then this count will have to be compared with some value(exp 3 from parameter) to calculate KPI as red or green. And with KPI green and red I need to plot a pie chart showing no of sites in green and red.

• ###### 3. Re: Need a help to create Pie Chart using measure

Still don't really understand your need. You current formula is only going to produce a single result:

if Count([Subject No]) >3 then 'Red' Else 'Green' end

Either Red or Green, it can't be both. So if you put that on the color shelf it will either be red or green. What condition are you wanting to use to divide the pie into segments?

--Shawn

• ###### 4. Re: Need a help to create Pie Chart using measure

Hi Vishal,

Like Shawn I'm not entirely clear on what you are trying to accomplish.  Are you expecting a result like below?

Regards,

Ivan

• ###### 5. Re: Need a help to create Pie Chart using measure

Hi Ivan,

I need to show the count for KPI for site and country level like below.

For Site Level: No of sites in risk against total sites

For Country Level: No of countries in risk against total count. To identify country risk we can see if more than 2 sites are in risk then country will be in risk.

• ###### 6. Re: Need a help to create Pie Chart using measure

Hi Vishal,

First off you should convert site to a dimension.

Create a field which you will use to color the pie Color: IF { FIXED [Site] : COUNT([Subject No]) } > [n] Then 'Red' ELSE 'Green' END

Then drag [Color] to colors and put CountD([Site]) on angle, size and label.

Something like

IF { FIXED [Country] : COUNTD(IF [Color] = 'Red' THEN [Site] END) } > 1

THEN 'Red' ELSE 'Green' END

should work for finding at-risk countries but it can't really be tested with the sample data.

• ###### 7. Re: Need a help to create Pie Chart using measure

Thanks Ivan, This was very helpful but I don't have 9.x version from customer, I am using 8.2 and looking for some solution in old version only.

• ###### 8. Re: Need a help to create Pie Chart using measure

Appreciate if any solution can be suggested for 8.2 version. Thanks in advance....