Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

brainteaser (at least for me)

See sample data below.

I am basically trying to figure out the math to add up all customer "returns" of products that they immediately turned around and purchased again.

For example if a customer returns 300 boxes of a product on one day and then turns around and buys them right back 1 week later. That is the behavior I am trying to identify and would like to add up the dollar amount of all returns that satisfy this condition.

If the subsequent sale occurs later on (say, 3 weeks) I am not worried about it and do not want to include it in the total.

Hopefully this makes sense - any ideas are greatly appreciated. error loading image

6 Replies
Not applicable
Author

Hi Keith,

my first idea are:

- splitt OrderType in two fields (Sales and Return)

- define the gap between Sales and Return (3 weeks)

- use the class() function and find out all deals in this timeframe (by Product, Customer or so ...)

Do you have some sample data?

Rainer

Not applicable
Author

What about using SET command...

Jerrik

Not applicable
Author

Thank you both for the replies. I have attached some sample data.

I have not used CLASS or SET before but will take a look.

Not applicable
Author

Hi Keith,

see the attached example. Hope it´s a little step forward.

Rainer

Not applicable
Author

Keith,

here are an "CLASS" example. It´s in GERMAN but the syntax should be clear.

Rainer

Not applicable
Author

Thank you Rainer I will examine this and get back to you.