10 Replies Latest reply on Nov 3, 2011 12:38 PM by philmodjunk

# Pie Chart to show profit margin?

### Title

Pie Chart to show profit margin?

### Post

Hi,

I'm trying to make a pie chart in my projects table that compares the total costs of the project vs. the Project's Value.

I have a caculation field for total costs (c_OurCosts), a calculation field for the total Project value, which simply adds all related sales orders and change orders (c_ProjectValue), and a calculation field that shows the Profit on Return (c_ProfitOnReturn).

The Profit on Return field uses this calc:

(c_OurCosts / c_ProjectValue) * 100

When I use that calculation on a particular project I get the result of 48.95, which tells me that the pie chart should be split almost equally between our cost and the project value, but what I'm getting displayed is Project value = 67.14% and Our cost = 32.86%.

My pie chart is setup as such:

Label Data: "Our Costs" & ¶ & "Project Value"

Value Data: PROJECT::c_OurCosts & ¶ & PROJECT::c_ProjectValue

Current Record (deliminated data)

What am I doing wrong?

• ###### 1. Re: Pie Chart to show profit margin?

On what table is the layout for your chart based?

If you place c_OurCosts and c_ProjectValue on your layout, next to the pie chart object, do you see the expected values?

• ###### 2. Re: Pie Chart to show profit margin?

I have the chart in the projects table layout. The values are on the same layout.

The example project  I mentioned earlier is showing:

c_ProjectValue = \$9,010.00

c_OurCosts = \$4,410.63

So you can see that the cost value is almost half of the project value. I have attached screeshot showing the pie chart and values together.

• ###### 3. Re: Pie Chart to show profit margin?

With OurCosts = 4,410.63, the chart is displaying:

4,410.63 / ( 4,410.63 + 9,010) * 100 = 32.86%

And
9010 / ( 4,410.63 + 9,010) * 100 = 67.14%

• ###### 4. Re: Pie Chart to show profit margin?

OK. So I guess the better question is how do I show the profit on return calc in the pie chart along with our costs?

The Profit on Return field uses this calc:

(c_OurCosts / c_ProjectValue) * 100

Math is not my best subject and this is getting hard to wrap my head around...

• ###### 5. Re: Pie Chart to show profit margin?

Each item charted has to be a "part of the whole" in a pie chart and the "whole" has to be the sum of the charted values.

Try charting c_OurCosts and c_ProjectValue - cOurcosts as your two delimited values. That makes c_ProjectValue the "whole".

• ###### 6. Re: Pie Chart to show profit margin?

Ok finally figured out:

I created a new calc field that takes the Project value and minus the costs.

Then the piechart uses the new field and the our cost field.

Now I get 51 to 49 % ranges that I was looking for.

• ###### 7. Re: Pie Chart to show profit margin?

You don't actually need the calc field though that works. You can just create the calculation in the delmitted value expression specified for this chart.

• ###### 8. Re: Pie Chart to show profit margin?

Thanks Phil that makes sense.

• ###### 9. Re: Pie Chart to show profit margin?

Oh one more related question

How would you hide a chart like this if no values are present in the fields?

Right now it show exactly 50/50 if the values are empty. Thought it would be better interface to have the pie chart empty in that case.

• ###### 10. Re: Pie Chart to show profit margin?

You might hide the chart inside an invisible tab control with two panels, one empty and one with the chart. If you give each tab panel an object name, the OnRecordLoad script trigger can run a script that uses Go To Object to specify the appropriate panel.

Tab controls can be made invisible by specifying o width borders and a color that matches the layout color. You use the Name box in the Inspector's position tab to give layout objects object names.