Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating Market Share

I have below table in market share I want total of Year. its working fine but value is showing in 1st row of every year.

I have used aggr function =aggr(sum(Sale),Year).

I want to show total of 2012 of every row of 2012 and total of 2013 in every row of 2013 and so on.

Thanks,

Maksood Alam

1 Solution

Accepted Solutions
simenkg
Specialist
Specialist

sum(Total <Year> Sale)

View solution in original post

4 Replies
simenkg
Specialist
Specialist

sum(Total <Year> Sale)

Not applicable
Author

Thanks Simen

simenkg
Specialist
Specialist

No problem

The thing you actually asked about is the reason why your expression only gives you the value in the first row. This is because the Aggr function is distinct by default, meaning it will only populate one of the lines. So to specifically answer your question, you can use the function =aggr(NODISTINCT sum(Sale),Year).

However, the reason I replied with the above expression is because its performance is much better and in this case will yield the right answer.

Regards

SKG

Not applicable
Author

Cool..

I got your point. Thank you very much Simen for explaining this point. It's really very helpful.