19 Replies Latest reply: Feb 7, 2018 7:01 AM by Sunny Talwar

# 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

• ###### Re: Sum of the same companies in different years

Hi,

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

and one Expression : sum(Amount)

• ###### Re: Sum of the same companies in different years

Hi,

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

• ###### Re: Sum of the same companies in different years

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.

• ###### Re: Sum of the same companies in different years

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

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

• ###### Re: Sum of the same companies in different years

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.

Thanks,

Pooja

• ###### Re: Sum of the same companies in different years

Can I make the bar chart and and show new the new company as it is in this picture?

• ###### Re: Sum of the same companies in different years

It can be done using set analysis

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

• ###### Re: Sum of the same companies in different years

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)

• ###### Re: Sum of the same companies in different years

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

• ###### Re: Sum of the same companies in different years

Company 43 is added in 2017

So, here are the screenshots . Sum Should be 28.78

• ###### Re: Sum of the same companies in different years

Isn't your year field called n.year? I am not sure if you need to change your set analysis to make sure it is n.year

• ###### Re: Sum of the same companies in different years

It works correctly, also when I click 2017 , everything is shown.

But when I click 2016  it doesn't work

• ###### Re: Sum of the same companies in different years

What doesn't work? Can you share a sample and explain what you need?

• ###### Re: Sum of the same companies in different years

May be, you don't have 2015 data, so it shows nothing when you click 2016, what if you change it to Min(Year)? -

Sum({<Company = p({<Year = {"\$(=Min(Year)"}>})>}Measure)

• ###### Re: Sum of the same companies in different years

Can I make the bar chart and and show the new company as it is in this picture?

• ###### Re: Sum of the same companies in different years

I think you can... would you be able to share a sample app?

• ###### Re: Sum of the same companies in different years

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

• ###### Re: Sum of the same companies in different years

i think you want the sum for each companie displayed for each year , for example :

2016   A  50000

B  60000

C  59000

2017  A   100000

B   80000

C   55000

X   70000

if you want like that you have to add two dimensions one for year and second for Companies and in the measure add sum(field)