Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing 2 dates in sense cloud

Good afternoon,

Let me start by saying that I'm really new to qlik and it's also not my usual field of work so sorry if this feels trivial.

I'm using Qlik Sense Cloud version fyi.

I want to count the number of orders from returning customers vs new ones.

For that I have a date of order (order_created_at) and a date of account creation for each customer (account_created_at).

To calculate the KPI number of orders, I basically count the order this way

count (distinct order_id)

To calculate the KPI new customers, I would want to do exactly the same only if the dates are matching.

if ( date(order_created_at) = date (account_created_at), then count (distinct order_id))

This tells me there is an error so I tried also the following:

if ( $(order_created_at) = $(account_created_at), then count (distinct order_id))

There is no longer an error but it doesn't count anything as if the condition was never meant.


Trying to read resources I'am a bit lost on how to proceed.

I tried to use tables and variables to find my way around but without success so far.


If anyone understands what I'm trying to achieve and have a solution it would be most welcomed.


Many thanks

RegnierP


1 Solution

Accepted Solutions
Gysbert_Wassenaar

Make sure order_created_at and account_created_at are real date fields and not text values and then try this expression:

count (distinct if( order_created_at=account_created_at, order_id))


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Make sure order_created_at and account_created_at are real date fields and not text values and then try this expression:

count (distinct if( order_created_at=account_created_at, order_id))


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

I read so many posts on the IF function and never saw anything like your suggestion.

It works perfectly!

Many thanks

philippe

Gysbert_Wassenaar

Great. Glad to hear it solved your problem. Would you mind marking this discussion as answered?


talk is cheap, supply exceeds demand