Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Carlaf_93
Creator
Creator

Set analysis

Hi,

i would like to select a customer and be able to see how many days go between the last sale and the previous one.

 

Thanks.

2 Solutions

Accepted Solutions
Taoufiq_Zarra
Master II
Master II

@Carlaf_93  I understood no need to do a set analysis.

for exampe :

Taoufiq_ZARRA_0-1591710914599.png

if I selected A as customer :

max(date)->14/06/2020

previous one->01/05/2020

So to calculate nbr of days u can use :

 

=Floor(Date(Max(Date)))-Floor(Date(Max(Date,2)))

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

Taoufiq_Zarra
Master II
Master II

Can you share with me how you calculate 33, because :

between 19/03 and 12/02 ->35 days

between 23/04 and 19/03 ->35 days

between 23/05 and 23/04 ->30 days

between 19/06 and 23/05 ->27 days

the avg thus is 31.75

Script:

 

=Avg(
aggr(
floor(DATE_A)-floor(above(DATE_A))
,CUSTOMER,DATE_A

)
)

 

 

 

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

6 Replies
Taoufiq_Zarra
Master II
Master II

@Carlaf_93  I understood no need to do a set analysis.

for exampe :

Taoufiq_ZARRA_0-1591710914599.png

if I selected A as customer :

max(date)->14/06/2020

previous one->01/05/2020

So to calculate nbr of days u can use :

 

=Floor(Date(Max(Date)))-Floor(Date(Max(Date,2)))

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

Carlaf_93
Creator
Creator
Author

Thank you!

And if i want the average number of days between all the sales of one customer?

Taoufiq_Zarra
Master II
Master II

can you share a sample data and the expected value of the avg ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Carlaf_93
Creator
Creator
Author

LOAD * INLINE [
DATE_A, CUSTOMER, SALES,

12/02/2019, A, 3,

19/03/2019, A, 30,

23/04/2019, A, 7,
23/05/2019, A, 7,

19/06/2019, A, 3,
];

I expect an average of 33 days for customer A

Taoufiq_Zarra
Master II
Master II

Can you share with me how you calculate 33, because :

between 19/03 and 12/02 ->35 days

between 23/04 and 19/03 ->35 days

between 23/05 and 23/04 ->30 days

between 19/06 and 23/05 ->27 days

the avg thus is 31.75

Script:

 

=Avg(
aggr(
floor(DATE_A)-floor(above(DATE_A))
,CUSTOMER,DATE_A

)
)

 

 

 

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

Taoufiq_Zarra
Master II
Master II

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉