Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

simotrab
Contributor II

Set Analysis with date

Hi community,

today I have a problem with set analysis and dates. My goal to reach is to have a sum of a quantity in the month of today. Here what I have done:

Sum({$<TypeOfQuantity={"A"},[MonthName]={"=month(today())"}>}Quantity)

I've thought several solutions, but none of them worked.

My variable called MonthName is something like:

jan

feb

mar

...

dec

and in the setting of the script the name of the months are equal, i.e.:

jan

feb

mar

...

dec

Quite weird that if I put a constant in place of  month(today()), it works!

So I tried

Sum({$<TypeOfQuantity={"A"},[MonthName]={"=month(date(today()))"}>}Quantity)

Sum({$<TypeOfQuantity={"A"},[MonthName]={"=monthname(today())"}>}Quantity)

But none of them worked.

How can I do it?

1 Solution

Accepted Solutions
jmvilaplanap
Valued Contributor

Re: Set Analysis with date

Hi Simone


You must to write your expression inside $(=EXPRESSION)


Sum({$<TypeOfQuantity={"A"},[MonthNum]={"$(=num(month(date(today()))))"}>}Quantity)


Try now

4 Replies
jmvilaplanap
Valued Contributor

Re: Set Analysis with date

Hi,

In my opinion

Try to use numbers instead formatted dates. For example

Sum({$<TypeOfQuantity={"A"},[MonthNum]={"=num(month(date(today())))"}>}Quantity)


I don't know why but not always the date functions return a data well formatted and less with Set Analysis.


Regards

simotrab
Contributor II

Re: Set Analysis with date

Hi Jose,

unluckily it does not work no one of these:

Sum({$<TypeOfQuantity={"A"},[MonthNum]={"=(month(today())"}>}Quantity)

Sum({$<TypeOfQuantity={"A"},[MonthNum]={"=month(date(today()))"}>}Quantity)

Sum({$<TypeOfQuantity={"A"},[MonthNum]={"=num(month(date(today())))"}>}Quantity)

jmvilaplanap
Valued Contributor

Re: Set Analysis with date

Hi Simone


You must to write your expression inside $(=EXPRESSION)


Sum({$<TypeOfQuantity={"A"},[MonthNum]={"$(=num(month(date(today()))))"}>}Quantity)


Try now

simotrab
Contributor II

Re: Set Analysis with date

Now it works fine, thanks!

Community Browser