Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

sturmeyp
New Contributor II

Help on Set Analysis expression

Hi All

Could someone help me on syntax for a set analysis expression

The purpose is to calculate sales value for Year to date.

The expression below works OK but as you can see I've hard coded the month values

Month 1 is OK as that will never change but I need a way to get current month value

So for example how to I replace 6 with a function or variable?

if(vDateRangeSelection = 'YTD',

Sum({1<Month = {">=1 <=6"},

[Year]={'2018'},

[Customer Type]={"External"}

>} [Potential Value])*vCurrencyRate,))

any help appreciated

Paul

5 Replies
MVP
MVP

Re: Help on Set Analysis expression

If you already have a current month calculated and stored in a variable you could just replace the 6 with $(vCurrMonth).

If you want to calculate it when the chart is rendered you can replace the 6 with something like:

$(=Num(Month(Today(1))))

sturmeyp
New Contributor II

Re: Help on Set Analysis expression

thanks Petter,

The second option worked best for me ... (using $(=Num(Month(Today(1))))

One question ...what does the 1 mean after the today part of the expression?

Paul

yashdeep
New Contributor III

Re: Help on Set Analysis expression

today([ timer_mode])


Can have the following values:

0 (day of last finished data load)
1 (day of function call)
2 (day when the document was opened)

MVP
MVP

Re: Help on Set Analysis expression

Can you please mark the thread and the response that was correct as answered?

sturmeyp
New Contributor II

Re: Help on Set Analysis expression

Hi Petter

I don't see any option in the thread to mark it as correct or answered? 

On the response I only see 'Mark as Helpful; and on the thread I don't see any actions at all


Any advice?

Paul