Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Set Analysis with Variables

I am trying to figure out this set analysis and I cannot get it to work.  Basically I am trying to count a set of distinct values if they fall in the past 7 days and if their status is delivered:

count(distinct {<CalendarDate = {'>=$(=$(vSevenDaysAgo))'}, Status = {'DELIVERED'}>} OrderNumber)

This works by itself:

count(distinct {<Status = {'DELIVERED'}>} OrderNumber)

But when I add in the date it comes up with Zero.

Labels (1)
1 Solution

Accepted Solutions
Highlighted
Creator
Creator

For some weird reason I got it working by replacing the single quotes with double quotes..

count(distinct {<CalendarDate = {">=$(=vSevenDaysAgo)"}, Status = {'DELIVERED'}>} OrderNumber)

View solution in original post

10 Replies
Highlighted
Creator II
Creator II

Try this

count(distinct {<CalendarDate = {'>=$(=vSevenDaysAgo)'}, Status = {'DELIVERED'}>} OrderNumber)

Highlighted
Creator
Creator

That still gives me 0 and it should be showing 30.

Highlighted
Creator II
Creator II

Can you share sample data or .qvw file?

Highlighted
Creator
Creator

No, unfortunately I can not. 

Highlighted
Creator
Creator

For some weird reason I got it working by replacing the single quotes with double quotes..

count(distinct {<CalendarDate = {">=$(=vSevenDaysAgo)"}, Status = {'DELIVERED'}>} OrderNumber)

View solution in original post

Highlighted
MVP
MVP


@anseglko wrote:

For some stupid reason I got it working by replacing the single quotes with double quotes..

count(distinct {<CalendarDate = {">=$(=vSevenDaysAgo)"}, Status = {'DELIVERED'}>} OrderNumber)


It has a strong reason.

With new qlik engine,

single quotes are used only for exact match in comparison

double quotes are used for search expression

Check this: Quotes in Set Analysis

Highlighted
Creator
Creator

Okay! Thank you for the info

Highlighted
Creator
Creator

This did not work either.  It might be because we are on a different version of Qlik Sense.  What version are you running?  I'm going to download the latest version onto my desktop and see if I can get this to work.  Otherwise I'll do some fun stuff on the load to get it to work.

Highlighted
Creator
Creator

I'm running April 2019