+ Start a Discussion

Google Chart with formula



I made a formula using a google chart link.

+ SUBSTITUTE(TEXT(Margin_2012__c), ".","")+"," 
+ SUBSTITUTE(TEXT(Margin_2011__c), ".","")+"," 
+ SUBSTITUTE(TEXT(Margin_2010__c), ".","") 
+"|1000000,1000000,1000000", "No Image available", 150, 450)


This is a chart, which shows the margin by year in comparison with the target. The last line shows the target for 3 years, always 1 Mio. I would like to add a field, to allow the user to define the annual target. How could I add the value from this additional field to my formula?

Now the user needs to change the target directly in the formula, for example when the target should be more than 1 Mio, the user must go to the formula and add the value to the last line. It could be simpler when he changes only the appropriate field on the UI and the value in the chart changes automatically.


When I change the last line to +"|My_Target1_field__c,My_Target2_field__c,My_Target3_field__c", "No Image available", 150, 450) I receive an empty chart and I have date in my target fields.


Any suggestions?


Hi Petya,


I did not clearly understand the significance of the numbers - +"|1000000,1000000,1000000",  in the last line?

If you wish to replace the numbers with fields – then those fields must be properly Bounded to the related records.

As the fields - Margin_2012__c are wrapped in a () Braces i guess it should be +"|(My_Target1_field__c),(My_Target2_field__c),(My_Target3_field__c)", "No Image available", 150, 450)

Not sure if that works, but you may try. 



Hi and thank you for your answer.

The last line "|1000000,1000000,1000000", shows the background rows in my chart, which show the defined target per year. For example here I defined the target for the 3 years as 1.000.000 and that’s way I have the line  "|1000000,1000000,1000000"

I already tried this option, but it doesn’t work. When I use the fields in my formula on this way, I don’t get any results in my chart, and I have values for my target-fields.


Hi Petya, 


Merge fields should not be in "Doubel Quotes", check if this one works - 




Hi and thank you


it works on this way, but only partially, because to see the changed axis I need also to change this parameter in my formula chds=5,1000000,5,1000000. The parameter shows the number of values on my axis and the largest value, and here the largest value is still 1 Mio


+ SUBSTITUTE(TEXT(Margin_2013__c ), ".","")+"," 
+ SUBSTITUTE(TEXT(Margin_2012__c), ".","")+"," 
+ SUBSTITUTE(TEXT(Margin_2011__c), ".","")+
+ SUBSTITUTE(TEXT(Target1__c), ".","")+"," 
+ SUBSTITUTE(TEXT(Target2__c), ".","")+"," 
+ SUBSTITUTE(TEXT(Target3__c), ".",""), "No Image available", 150, 450)