4 Replies Latest reply: Aug 2, 2017 10:37 AM by Simone Trabattoni

# 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?

• ###### 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

• ###### 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)

• ###### 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

• ###### Re: Set Analysis with date

Now it works fine, thanks!