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

Last years Basket size

Hello eveybody,

I'm working on key numbers and would like to get some help. On my dashboard, I have something that looks like this:
Skärmklipp.PNG

As you can see to the left (Net Sales), I have also calculated net sales from last year (the blue numbers right next to it). If I'd like to do the same with for an example Basket size, how do I do that? My expression for basket size is: "sum(Sales)/count(DISTINCT [%Order])" and the expression for last years sale is: "Sum({<Year = {'$(=Max(Year) -1)'}>} Sales)".

I would like to combine these expression somehow. Instead of Sales I'd like to put in the expression for Basket size, like this:

Sum({<Year = {'$(=Max(Year) -1)'}>}sum(Sales)/count(DISTINCT [%Order]))


But it doesn't work of course. How do I write this in the best possible way?

Sincerely,

Betty Habtemariam

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think you would need to apply the set expression to all aggregations:

sum({<Year = {'$(=Max(Year) -1)'}>}Sales) / count({<Year = {'$(=Max(Year) -1)'}>} DISTINCT [%Order])

Note that your current basket size seems to be calculated across all years available.

View solution in original post

2 Replies
swuehl
MVP
MVP

I think you would need to apply the set expression to all aggregations:

sum({<Year = {'$(=Max(Year) -1)'}>}Sales) / count({<Year = {'$(=Max(Year) -1)'}>} DISTINCT [%Order])

Note that your current basket size seems to be calculated across all years available.

Not applicable
Author

Hi Swuehl,

Thank you VERY much! Your solution worked perfectly 😃 About my current Basket Size being calculated across all years available. The ones I'm doing it for wanted it that way.

Have a nice evening or day wherever you are 😃

Sincerely,

Betty Habtemariam