Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
nenadvukovic
Creator III
Creator III

Need to get sales in selected weeks and not sold in last 2 years preceding the selected weeks?

Hi,

I have sales details at the very granular level (invoice line) for last 3 years and need to identify customers who have had new SKU combinations sold to them in the last 6 weeks, for example, but never sold in the last 2 years preceding those 6 weeks, along with quantities, number of SKUs and totaled by product sub-family.

The end result should look something like this:

Customer A          Product Subfamily X      New SKUs: 4         Total pieces sold (of new SKUs)      200

Customer B          Product Subfamily X      New SKUs: 10       Total pieces sold (of new SKUs)      100

Is Alternate States a better choice here?

Or, to create new internal table?

Thanks for sharing the best approach



1 Solution

Accepted Solutions
nenadvukovic
Creator III
Creator III
Author

I believe I got it right:

Sold in last N days: sum({$<Date = {">=$(=date(today() - $(vDays)))"}>} Qty)

Sold before that: sum({$<Date = {"<$(=date(today() - $(vDays)))"}>} Qty)

Now, how can I eliminate lines where "Sold before that" = 0?

Thx

View solution in original post

2 Replies
d_pranskus
Partner - Creator III
Partner - Creator III

Hi Could you scramble your file and attach in a message here? Thanks

nenadvukovic
Creator III
Creator III
Author

I believe I got it right:

Sold in last N days: sum({$<Date = {">=$(=date(today() - $(vDays)))"}>} Qty)

Sold before that: sum({$<Date = {"<$(=date(today() - $(vDays)))"}>} Qty)

Now, how can I eliminate lines where "Sold before that" = 0?

Thx