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: 
t_chetirbok
Creator III
Creator III

Comparison sum sales in Year with Previous Year

Hi!

I need to create straight table where Dimensions are Customer, Product, Storage, Year

and Expressions are sum(Sales) in Year and sum(Sales) in Previous Year.

Something like this:

where number in column F is Sales in 2015 and number in column G is Sales in 2015 -1

Any idea how can I do it?

Many thanks!

1 Solution

Accepted Solutions
sunny_talwar

If you are ever going to select one year, then may be this:

=Before(Sum({<Year = {$(=If(GetSelectedCount(Year) = 1, GetFieldSelections(Year)-1, Chr(39) & '*' & Chr(39)))}>}Sales))

Capture.PNG

View solution in original post

13 Replies
sunny_talwar

There are two ways to do this:

1) Either use the As-of table in the script (The As-Of Table)

2) or use Above(TOTAL ...) method.

For a more precise help, can you provide a sample?

Gysbert_Wassenaar

That looks like a pivot table to me. If you want to do this in a straight table you'll have to create two expressions for each year that you want to show.


talk is cheap, supply exceeds demand
t_chetirbok
Creator III
Creator III
Author

Ok, it is a pivot table.

what I need to write in expression?

I have year in dimension and one expression is sum(sales) and second?

Gysbert_Wassenaar

Try sum(sales) and before(sum(sales))


talk is cheap, supply exceeds demand
t_chetirbok
Creator III
Creator III
Author

I attached small example

t_chetirbok
Creator III
Creator III
Author

I attached small example

sunny_talwar

Gysbert's solution seems to be working, isn't it? or are you looking for something else?

Capture.PNG

t_chetirbok
Creator III
Creator III
Author

It is correct when Year doesn't select

and if select Year, for example 2016, it's not correct

Gysbert_Wassenaar

See attached example


talk is cheap, supply exceeds demand