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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis use OR

I am trying to show data for only yesterday and today. I have a variable that calculates yesterday's date vMaxDate. I want all sales where the Date = Yesterday OR the date = Today.

vMaxDate is yesterday because that is our report cutoff BUT some sales come thru with today's date so I want to see those as well. I am using v9

I used the below but it only picks up yesterday's sales, not todays. What am I doing wrong?

sum({<Date ={"$(#vMaxDate)","$(#vMaxDate)+1"} ,[Subscription Indicator]={"Non-Subscription"}>} [TOTAL BOOKED ($)])/1000





2 Replies
matt_crowther
Specialist
Specialist

Unchecked expression that should in principal work:

=sum(if(Date=today() or Date = today()-1,Sales))

You may have to put date() functions round the 'Date' and today to ensure they're the same format but there's no reason that shouldn't work.

It should then be a simple(ish) process to get it into Set Analysis.

Hope that helps,

Matt - Visual Analytics Ltd

pover
Partner - Master
Partner - Master

Matt's solution should work, but just so that you understand set analysis, you need to put the formula within the dollar-sign expansion $() like the following:

sum({<Date ={"$(vMaxDate)","$(=vMaxDate+1)"} ,[Subscription Indicator]={"Non-Subscription"}>} [TOTAL BOOKED ($)])/1000

And you might be careful that the MaxDate variable returns a value in the date format like

date(max(Date))

Regards.