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

Set current MonthYear in a variable

Hello, I am using MasterCalendar and I want to filter data which is from current MonthYear.

I create this variable:

vCurrentMonthYear = Date(monthstart(Today()),'MMM-YYYY')

but when I use it in a set expression, for example like this:

SUM({MonthYear={$(vCurrentMonthYear)}} sale_total)

don't select anything. Why?

11 Replies
josecanalla
Creator
Creator
Author

It works! Thanks!

I only change the variable definition, the load script was not neccesary.

josecanalla
Creator
Creator
Author

One more question. If I want to store the previous MonthYear than actual in a variable, how should I calculate it?

EDIT: I found the response:

=Month(AddMonths(Today(),-1))& '-' & Year(AddMonths(Today(),-1))