Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
edelorme
Partner - Contributor II
Partner - 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
JonnyPoole
Employee
Employee

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.

View solution in original post

3 Replies
JonnyPoole
Employee
Employee

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
Partner - Contributor II
Partner - Contributor II
Author

Thanks Jonathan, I will give this a try.

kwdaniels
Partner - Creator
Partner - Creator

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 ?).