Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

edelorme
New Contributor II

Net Total line in Qlik Sense line chart

Hi

I have a line chart that contains 2 Dimensions and 1 Measure. I would like to add a Total line that would be a sum of each data point. Unfortunately I can't add more than 1 measure with this chart setup. Does anyone know of a way/workaround to accomplish this?

Thanks.

1 Solution

Accepted Solutions
Employee
Employee

Re: Net Total line in Qlik Sense line chart

Hi eric - i've resolved this kind of issue by introducing a custom dimension in the data model. It involves adding a new table in the load script that produces a 'Total' bucket alongside the values of your 2nd dimension .

If your 2nd dimension was region, and the values were    NA, EMEA and APAC  .  Then a simple script to produce a 4th 'total' or 'all' region is as follows

RegionsForTotals:

Load

     Region as Region,

     Region as RegionForTotalChart

resident <existingtable>;

concatenate (RegionsForTotals)

Load

     Region as Region,

     'Total' as RegionForTotalChart

resident <existingtable>;

this will produce a new dimension called RegionForTotalChart which you can use to replace your existing 2nd dimension.  Notice that the data model associates the individual regions with themselves, but the total is associated with all possible regions forcing the measure aggregation for the 'total' value to work across all values.

3 Replies
Employee
Employee

Re: Net Total line in Qlik Sense line chart

Hi eric - i've resolved this kind of issue by introducing a custom dimension in the data model. It involves adding a new table in the load script that produces a 'Total' bucket alongside the values of your 2nd dimension .

If your 2nd dimension was region, and the values were    NA, EMEA and APAC  .  Then a simple script to produce a 4th 'total' or 'all' region is as follows

RegionsForTotals:

Load

     Region as Region,

     Region as RegionForTotalChart

resident <existingtable>;

concatenate (RegionsForTotals)

Load

     Region as Region,

     'Total' as RegionForTotalChart

resident <existingtable>;

this will produce a new dimension called RegionForTotalChart which you can use to replace your existing 2nd dimension.  Notice that the data model associates the individual regions with themselves, but the total is associated with all possible regions forcing the measure aggregation for the 'total' value to work across all values.

edelorme
New Contributor II

Re: Net Total line in Qlik Sense line chart

Thanks Jonathan, I will give this a try.

kwdaniels
New Contributor III

Re: Net Total line in Qlik Sense line chart

This worked like a charm. Thanks, Jonathan, for saving my day!

I look forward to the day when Qlik starts to build in more of this kind of basic functionality directly into Qlik Sense like they do for QlikView, with a simple "Show Total" checkbox (How to Calculate Sum of Volumes(Total) of all products for a given Market in a Line Chart ?).