Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Tell us which business and trade publications you read most regularly: RESPOND NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using a custom measure in simple set analysis

Hi,

I'm pretty new to Qlik Sense, I've been playing around with set analysis for a while but now I'm stuck on something that should be easy to solve...

I have sales data sample where my time reference is "OrderDate"

What I'm looking for is to get the sum of  sales for the most recent available day which is 01/06/2008 ; I consider this day as my 'today'

so I write the following: sum({$<OrderDate={"01/06/2008"}>}Sales)... this works I get 50,27K in Sales that day

No what I'm trying to do is to create a measure that I can reuse to simulate a today date so it can be reusable

so I created a measure called 'vToday' =  Date('01/06/2008','DD/MM/YYYY')

My issue is that when I write the following expressions sum({$<OrderDate={vToday}>}Sales) I get Sales = 0 , which is not correct

What am I doing wrong here?

Thanks

Tom

3 Replies
julian_rodriguez
Partner - Specialist
Partner - Specialist

Hello Tom

First of all, if you want to calculate the most recent available day, you shoud use something like:

Sum({<OrderDate = {'$(=Date(Max(OrderDate)))'}>} Sales)

if your most recent day is for example: 8/14/2015, it will try to evaluate this:

Sum({<OrderDate = {'8/14/2015'}>} Sales)

On your set analysis, notice the " ' " symbol, because it will try to make a division instead of read a string.


Hope it helps


Regards

swuehl
MVP
MVP

Try

sum({$<OrderDate={'$(vToday)'}>}Sales)

maximiliano_vel
Partner - Creator III
Partner - Creator III

Use this instead


sum({$<OrderDate={$(vToday)}>}Sales)