Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression for previous weeks' sales calculation

Hello,

I am currently using the following expression to display current and previous 6 weeks' ytd sales figures

=sum({$<WK_NUM= {"<=$(=Selected_Week) >=$(=Selected_Week-6)"}>} sales_ytd)/1000

I need to implement the same logic when calculating wtd sales figures for the current and previous 6 weeks. The way I derive a week-to-date sales figure is (e.g for wk 13): = WK 13 YTD - WK 12 YTD.

Help will be much appreciated.

Thank you!

3 Replies
Not applicable
Author

Hi,

Expression 1: Current Sales for last 7 weeks (with your expression). Sort the table by week asc.

Expression 2: Previous(Expression 1).

Expression 3: Expression 1 - Expression 2.

Hide expression 1, 2 and uncheck show zero values.

Hope this helps.

Regards,

Kiran.

Not applicable
Author

Hi Kiran,

Thanks for this but I had no luck. Any other thoughts?

Thanks

swuehl
MVP
MVP

Hi,

I must admit I haven't fully understood your requirement, but Kiran's approach might just need to use

above(Expression1)

instead of previous (if you are using a straight table with dimension WK_NUM), I think previous can only be used in the script.

Stefan