Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Skip the ticket, Chat with Qlik Support instead for instant assistance.
Showing results for 
Search instead for 
Did you mean: 
Partner - Contributor III
Partner - Contributor III

Chart Level Scripting Use Case

Hi everyone,

Can Anyone provide me with the use case of char level scripting, i am not getting the idea how can i put chart level scripting in use, any suggestion, example or use case is welcome.

Labels (3)
5 Replies

Here is a use case I've come up with. Adding a Total bar to a bar chart. 


You would think this could be done with the chart script:

Add Load
'Total' as Division,
sum(Sales) as Sales
Resident HC1;

But that script actually replaces the first row, not what I expect. I'm unsure if that is a bug or a misunderstanding on my part. 


As a workaround, I can make it work with this script (this is how the first picture was generated)

Let vTotal = 0;
Let P = HCNoRows();
For J = 1 to P
  Let vTotal = vTotal + HCValue(Sales,J);
Add Load 'Total' as Division, $(vTotal) as Sales Autogenerate 1;



Partner - Contributor III
Partner - Contributor III

Thanks sir,

so it means we can add new measures in particular char with the chart level scripting.


Yes, I believe you can add new Measure columns. The documentation and examples are still rather scant. 



I don't have access to that version yet, but if I understand this feature properly I suspect it could be used for creating custom row subtotals like in a p&l statement which previously required some combination of extensions and/or making changes to the data model to load in dummy fields.


Hi Rob, since you seem to have gotten this working a lot better than I have so far - have you had any luck adding data from a secondary source (not autogenerate/inline)? Documentation suggests we can use a following SQL statement, which would be brilliant as it would allow for real-time object updates from a database source, except I think that's just copy-pasted from the "regular" Load statement help page. I have not had any luck adding information from an SQL source or even from a resident table, though this might be an issue on my end given the lack of documentation and guesswork involved in getting the syntax right...