Extract Month and Year from date to use in ifElse calculated field


I want to create a calculated field that gives me 1 if the month and year is the current one. the objective is to apply conditional formatting to some metrics to highlight them for the current month.

I tried the following first calculated field called MonthYearField:
extract("MM", {date}) + '-' + extract("YYYY", {date})
but I cannot combine Number and String…

The second step would be: ifelse(MonthYearField = date_format(now(), 'MM-YYYY'), 1, 0)

Any suggestions?



You can try using dateDiff

Something like this maybe?

ifelse(dateDiff({Order Date},now(),'MM')=0,1,0)

Kind regards,

Thanks for it @andres007 , it worked as I expected!