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

Qliksense show total income compared to the previous year

Hi Everyone,

I am trying to show on my Qlik Sense app , in a bar chart, the total income compare to the previous year.

the dim is : product name

the measures :

finding the last year that had a sale in this product: Sum({$<[SaleYear]={$(=Max([SaleYear]))}>}  [Total income])

finding the previous year: Sum({$<[SaleYear]={$(=Max([SaleYear])-1)}>}  [Total income])

I have couple of problems:

1) Not all the product had started to sale on the same year , f or eample: product A sold in :2005,2006,2007 - so in my bar chart I want to see in the bars only the totoal income of 2007 and 2006(the previous year), product B sold in : 2004,2005 - so in my bar chart I want to see the bars only of 2005 and 2004(the previous year).

So in the Legend in the bar chart , I need to have all the years that are possible :2004-2007, and in every product in the bar chart there will be only 2 bars .

2) the Lable of each expression can't calculate the values:

=Max([SaleYear])

=Max([SaleYear])-1

it's just show the string I wrote.

thanks for your help

5 Replies
sunny_talwar

1) Try these:

FirstSortedValue(Aggr(Sum([Total income]), [product name], [SaleYear]), -Aggr([SaleYear], [product name], [SaleYear]))

FirstSortedValue(Aggr(Sum([Total income]), [product name], [SaleYear]), -Aggr([SaleYear], [product name], [SaleYear]), 2)

2) Even if Qlik Sense allowed to show Max([SalesYear]), which year would you have seen 2007 for Product A or 2005 for Product B as the max year?

Not applicable
Author

1)Thanks for your answer, but it did not worked- I attached the project to my original question,  so you can look at it .

2) They want to know how these products perform compared to the previous year- that is what they asked me to show.

so I guess that  there will be different maxYear for each product.- am I right ? did I understand what they asked correctly ?

thanks

Moni

sunny_talwar

I don't see anything attached. Can you check

Not applicable
Author

Soory , I had problems loading .

So I load it to the web , just download it from here :

http://www.filedropper.com/test_73

Thanks again

Moni

Not applicable
Author

Soory , I had problems loading .

So I load it to the web , just download it from here :

http://www.filedropper.com/test_73

Thanks again

Moni