Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following table :
CUST_USER_ID | PURCHASE_EVENT_DT | |
---|---|---|
1 | 04/5/2014 | |
1 |
| |
1 |
| |
3 |
| |
2 |
| |
2 |
|
I want to calculate the number of buyers who do their first purchase the date that qlikVIew users select through a calendar object.
For example,
In 04/5/2014, the total number of new buyers are 2 ( cust_user_id: 1 , 3 )
In 05/5/2014, the total number of new buyers is 0
In 10/5/2014, the total number of new buyers is 1 ( cust_user_id: 2 )
I try to do it using the following set analysis :
Count({<min(PURCHASE_EVENT_DT)={$(vSelectedDate)}>} distinct CUST_USER_ID)
But there is an error in set analysis. Can you help me please?
Dimitra:
If you can not open the file, use this expression:
='New Customers: ' &COUNT(DISTINCT IF( vDateRef = aggr(min(PURCHASE_EVENT_DT),CUST_USER_ID), CUST_USER_ID))
Try:
Count({<PURCHASE_EVENT_DT={"=$(vSelectedDate)"}>} distinct CUST_USER_ID)
Do not forget that the dates have to be in the same formats.
You cannot use min (or any other function) in the left part of the expression, I think that if the use selects a date the expression can be:
Count(distinct CUST_USER_ID)
or (to be sure of the selected date):
Count({<PURCHASE_EVENT_DT={$(=GetFieldSelections(myFieldDate))}>} distinct CUST_USER_ID)
where myFieldDate is the field in the multibox selected by the user
Let me know
The following set analysis calculates the number of buyers per selected date and not the number of new buyers per selected date.
Count({<PURCHASE_EVENT_DT={$(=GetFieldSelections(myFieldDate))}>} distinct CUST_USER_ID)
If a buyer had had a purchase before the selected date, he should not be appeared as new buyer in the selected date but he should be appeared as new buyer the date that he had done his first purchase.
So, i want to select a date and see the number of users who did their first purchase this date.
Dimitra,
See the attachment.
Dimitra:
If you can not open the file, use this expression:
='New Customers: ' &COUNT(DISTINCT IF( vDateRef = aggr(min(PURCHASE_EVENT_DT),CUST_USER_ID), CUST_USER_ID))
Thank you very much. This is exactly what i want to do.
Have a nice day.