Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

TOTAL calculation

Hi All,

I am doing TOTAL with one measure and two dimension for instance:

Month, Product, Revenue

Jan, A, 1000

Feb, B, 4000

---

---

---

I want to display this data in line chart, can you please help with expression please.

I tried below expression but it not giving right values.

1. Sum(Revenue)/Sum(Total Revenue)

2. Sum(Revenue)/Sum(Total <Product> Revenue)

3. Sum(Revenue)/Sum(Total <Month> Revenue)

4. Sum(Revenue)/Sum(Total <Month,Product> Revenue)

Thanks,

Nihhal.

1 Solution

Accepted Solutions
nihhalmca
Specialist II
Specialist II
Author

Thanks Stefan.

Your expression is working with small change as

sum(Revenue)/sum({<Product=>} total <Month> Revenue)

View solution in original post

9 Replies
MK_QSL
MVP
MVP

Can you provide the output you are looking along with sample data?

swuehl
MVP
MVP

What is the correct or right value you want to see, in a line chart using which field(s) as dimension?

You need to describe your requirement if you want us to help you.

nihhalmca
Specialist II
Specialist II
Author

Dimensions are Month and Company.

Measure is Revenue

If i take single dimension it works perfectly, i am getting issue when i tried to add second dimension in chart (Line).

MK_QSL
MVP
MVP

Again half information..

You want Month and Company as dimensions and

% As Revenue for each line?

MK_QSL
MVP
MVP

You can use

Month and Company as Dimensions

and

SUM(Revenue) / SUM(Total <Month> Revenue)

as expression

nihhalmca
Specialist II
Specialist II
Author

Yes Manish.

nihhalmca
Specialist II
Specialist II
Author

Hi Manish,

I used this logic earlier (Please see at expression in original post)

However my requirement is little bit different.

For instance:

Show data by your logic but whenever i select product=A in filter (listbox), chart shows expression value wrong (it calculate like 1000/1000).

But i want to calculate like 1000/5000 (as per my example in original post)

swuehl
MVP
MVP

Thanks for finally mentioning your requirement.

If you need to ignore user selections, you need to use Set Analysis.

Something like

=SUM(Revenue) / SUM({1} Total <Month> Revenue)

nihhalmca
Specialist II
Specialist II
Author

Thanks Stefan.

Your expression is working with small change as

sum(Revenue)/sum({<Product=>} total <Month> Revenue)