Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
braham
Creator
Creator

Inserting totals on a line graph

I would like to produce a line graph as follows: x axis is a time dimension (Months, quarters or years). Each line on the graph shows a product's profitability. If there are 4 products there will be 4 lines. I want to show a fith line with the profitability of the 4 products. How do I do it.

4 Replies
vgutkovsky
Master II
Master II

How about an expression like this: column(1)+column(2)+column(3)+column(4)

Would that give you the result you're looking for?

braham
Creator
Creator
Author

Hi Vlad, I am looking for the total of each column, not the total of each line.

vgutkovsky
Master II
Master II

I don't understand. I'm assuming that profitability for each product is expressed by something the following formula: sum({<Product={"Product1"}>} revenue) - sum({<Product={"Product1"}>} costs). The second expression would be the same, except that it's Product2, etc. These will, of course, be evalutated over your time dimensions. So by writing the expression for the 5th line as column(1)+column(2)+column(3)+column(4), you would essentially be expressing the profitability of all the products. This would still be evaluated over your dimensions, and would not be the total of the line.

Regards,

braham
Creator
Creator
Author

Thanks Vlad, your formula is correct and would work if there were a fixed number of products. Assuming for one region there was 4 products and for another there was 10. You would need to cater (in your calculations) for the total number of products. This would make it very difficult when selecting other dimensions in your model. I would like a total fuinction that works like the total column function works in a Pivot Table.