Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
simotrab
Creator III
Creator III

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
Specialist
Specialist

Hi Simone


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


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


Try now

View solution in original post

4 Replies
jmvilaplanap
Specialist
Specialist

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
Creator III
Creator III
Author

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
Specialist
Specialist

Hi Simone


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


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


Try now

simotrab
Creator III
Creator III
Author

Now it works fine, thanks!