Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts
I need the previous month for a measure. This expression is not working, it shows the current month and not the previous month.
Sum({<[Document Year]={$(=Year(Today()))},[Document Month]={$(=num(month(now()-1)))}>}
[Amount])
Any ideas?
Kind Regards, Thomas
Hi,
Your '-1' is in the wrong bracket, you are taking today -1, instead of month -1.
(=num(month(now())-1))
Kind regards
Thank you! This is correct.
A last question: Document Month for September is '09'. Today(Document Month) is '9'. How do I solve this difference?
[Document Month]={$(=(Today([Document Month]))-1)}>}
hi @Tommmy
that way your formula is going to fail when current or selected month is january
so, you better use something like addmonths()
example:
=count({< dv_date={">=$(=monthstart(addmonths(today(),-1)))<=$(=addmonths(today(),-1))"} >} id_delivery)
normally you should create variables for max and min value
vMaxDate = addmonths(today(),-1)
vMinDate = monthstart(addmonths(today(),-1))
use the '=' sign when defining the variable
and your measure could be like
=count({< dv_date={">=$(vMinDate )<=$(vMaxDate )"} >} id_delivery)
Best