Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Carlaf_93
Creator II
Creator II

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

@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

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

@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") 😉
Carlaf_93
Creator II
Creator II
Author

Thank you!

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

Taoufiq_Zarra

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 II
Creator II
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

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") 😉
Taoufiq_Zarra

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") 😉