Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Fields in Set Analysis

I am attempting to use two date fields in a set analysis. I have formatted these date fields to be comparable...ie (mm/d/yyyy).

The expression that I am attempting is below.

Count({$<CreateDate={"<=StartDate"}>} Distinct OrderIds)

I have not had any luck producing a correct result

Any Suggestions?

Thanks!!

1 Solution

Accepted Solutions
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

This set analysis condition could only work if you had a single available value of a StartDate.

Remember that Set Analysis conditions are evaluated "globally", e.g. outside of the specific chart dimensions. That being said, you can't compare CreateDate with the Start Date, if the StartDate is one of your Dimensions (or derived from one).

You can try something like the following:

Count({$<CreateDate={"=CreateDate<=StartDate"}>} Distinct OrderIds)

However, if both dates are in the same table, I'd rather recommend calculating a flag in the script and using the flag in your expression. Something like the following:

In the script:

If(CreateDate<=StartDate, 1, null()) as Created_Start_Flag,

...

In the expression:

Count({$<Created_Start_Flag={1}>} Distinct OrderIds)

Looks much more straight-forward to me...

good luck!

Ask me about Qlik Sense Expert Class!

View solution in original post

1 Reply
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

This set analysis condition could only work if you had a single available value of a StartDate.

Remember that Set Analysis conditions are evaluated "globally", e.g. outside of the specific chart dimensions. That being said, you can't compare CreateDate with the Start Date, if the StartDate is one of your Dimensions (or derived from one).

You can try something like the following:

Count({$<CreateDate={"=CreateDate<=StartDate"}>} Distinct OrderIds)

However, if both dates are in the same table, I'd rather recommend calculating a flag in the script and using the flag in your expression. Something like the following:

In the script:

If(CreateDate<=StartDate, 1, null()) as Created_Start_Flag,

...

In the expression:

Count({$<Created_Start_Flag={1}>} Distinct OrderIds)

Looks much more straight-forward to me...

good luck!

Ask me about Qlik Sense Expert Class!