Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am working on a set analysis expression and it seams I have the logic reversed. I would like my chart to show data only within the last two years.
Where should the greater than or less than operators be used within the equation?
count({<MonthYear ={">=$(=Date(AddYear(MonthYear, -2), 'MMM YYYY'))"}>}ID)
Hi @jonathanrichey,
The ' aren't working. You could use this. You only need to make sure that the field Date has the same format as the default date settings at the beginning of your script.
=count({<Date ={">=$(=Date(AddYear(MonthYear, -2)))"}>}ID)
Thanks for the quick response @avkeep01 !
My date is set to=
SET DateFormat='M/D/YYYY';
Currently I have MonthYear as my dimension. I am not sure what is calculating when using the updated expression (see MonthYear.png.
If I change my dimension to Date vs MonthYear my data displays only November and December 2015 (Date.png).
May be you need this
Count({<MonthYear = {">=$(=Date(AddYears(Max(MonthYear), -2), 'MMM YYYY'))"}>} ID)
UPDATE: fixed the function name to AddYears based on Omar's response below
Or this
Count({<MonthYear = {">=$(=Date(AddYears(Today(), -2), 'MMM YYYY'))"}>} ID)
UPDATE: fixed the function name to AddYears based on Omar's response below
Good catch 🙂
This works as well.Thanks for the responses!!