Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mrainey18
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
anseglko
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
bharathadde
Creator II
Creator II

Try this

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

mrainey18
Creator
Creator
Author

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

bharathadde
Creator II
Creator II

Can you share sample data or .qvw file?

mrainey18
Creator
Creator
Author

No, unfortunately I can not. 

anseglko
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)

tresesco
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

anseglko
Creator
Creator

Okay! Thank you for the info

mrainey18
Creator
Creator
Author

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.

anseglko
Creator
Creator

I'm running April 2019