Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum of the same companies in different years

Hello,

I have different companies in different years. I want to calculate the sum of the same companies in the  bar chart. The sum also should be for the max date.Bar should look like this

Capture.PNG

1 Solution

Accepted Solutions
sunny_talwar

It can be done using set analysis

Sum({<Company = p({<Year = {"$(=Max(Year) - 1)"}>})>}Measure)

View solution in original post

19 Replies
jaumecf23
Creator III
Creator III

Hi,

I understand that you need two dimensions : Company and Year.

and one Expression : sum(Amount)

YoussefBelloum
Champion
Champion

Hi,

try to attach some screen shots of the result you have, what is actually wrong, the desired output, the expression and dimension used.

Anonymous
Not applicable
Author

For example,

In 2016 ---- Companies : A,B,C,D,E,F

  In 2017 ---- Companies: A,B,C,D,E,F,G,H

I want to have the sum of the companies (A,B,C,D,E,F) in 2016 and in 2017.

Anonymous
Not applicable
Author

Hi,

Can you please share some sample data or detailed questions.

Here it seems that you want 2 dimensions one is your companies and other is years and sum(amount) as measures. So for this simply you can take bar chart and implement that.

Thanks,

  Pooja

ChennaiahNallani
Creator III
Creator III

take Dimension as a Year and measure sum({<Companies ={'A','B','C','D','E','F'}>}FieldName)

for all Companies sum({<Companies ={"*"}>}FieldName)

Anonymous
Not applicable
Author

Do you want like following... If yes ..simple take take bar chart and stacked companies from presentation.

Let me know it this works for you.

Untitled.png

Thanks,

Pooja

sunny_talwar

It can be done using set analysis

Sum({<Company = p({<Year = {"$(=Max(Year) - 1)"}>})>}Measure)

Anonymous
Not applicable
Author

Thank you all for your responses, 

In 2016 there were 5 companies , In 2017 two companies were  added. But I want to show the sum of the 5 companies that were in the last year too.  This formula seems correct, but  the sum is calculated for the 7 companies in 2017. ( I hope you understand what I mean)

sunny_talwar

I do and I would expect it to show the sum of only those 5 companies which were present in 2016. Would you be able to share an example where you can demonstrate it not working? This way we can see what is going on