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

Set Analysis

Hello All

I could not solve writing the expression for this problem, need ur help

Data:

Customer,Date, Sale1, Sale2

C1, 01/03/2014, 0,1

C1,01/10/2014,0,1

C1,01/25/2014,0,2

C1,03/02/2014,1,2

C1,04/01/2014,2,1

For each Customer, find the 1st Sale1 Date and then sum of Sale2 before this date.

ex: 1st Sale1 is on 03/02/2014 , i got to show sum(1+1+2) ...

6 Replies
Not applicable
Author

Try this

sum({<Date=P({<Sale1={"<=0"}>} Date)>} Sale2)

t_chetirbok
Creator III
Creator III

Hello!

Try this expression: sum({<Date={"<$(=date(min({<Sale1-={0}>}Date)))"}>}Sale2)

sebastianlettner
Partner - Creator
Partner - Creator

Hi,

this should work

=Sum({<Date={"<$(=Min({<Sale1=-{0}>} Date))"}>} Sale2)}

Regards Sebastian Lettner

Not applicable
Author

Min date got to be dynamic with the customer. each customer will have diff min date,i have not tried your exp but i assume $() sign will expand the exp before the calculation in the chart which makes it one min date for the entire table.

sebastianlettner
Partner - Creator
Partner - Creator

Hi,

do you need this to be done with set analysis?

If not, you could use this expression:

Sum(Aggr(If(Min(total<Customer>{$ <Sale1-={0}>}Date) <= Date, Sale2), Date, Customer)).

Regards
Sebastian Lettner

t_chetirbok
Creator III
Creator III

Hi! It's work perfectly! ))

try to use, if it's not work, share your example, please.