Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following code:
MonthName(AddMonths(Today(),-1))
This gives me the previous month before the current date i.e. Jan 2021
This works when I place within a text box but not when I create it within a variable.
Any ideas welcome.
Many Thanks
Martin
or
sum({<Month={'$(vMonthname)'}>}Amount)
or
sum({<Month={$(=vMonthname)}>}Amount)
when you display the content of the variable in a text box what do you see? use =Variable without the $() evaluation
also how do you use the variable? is it in set analysis?
How you are creating variables?
try this
vMonthname =MonthName(AddMonths(Today(),-1))
you can use now
$(vMonthname)
or
$(=vMonthname)
if not share your variable details with small example.
My intention is to use this within a set analysis, i.e.
=sum({<Invoice_Month={$(vMonthname) }>} Invoice_Amount)
If i populate with a hard coded date it works e.g.
=sum({<Invoice_Month={'Jan 2021' }>} Invoice_Amount)
may be try this
Sum({<Month = { '$( =$(vMonthname) )' }>} [Amount])
or
sum({<Month={'$(vMonthname)'}>}Amount)
or
sum({<Month={$(=vMonthname)}>}Amount)
Thanks for your help. i played around with it and this seems to do the job:
=Sum({<Invoice_Month={"$(vPreviousMonth)"}>}Invoice_Amount)
This is where vPreviousMonth is:
=MonthName(AddMonths(Today(),-1))
Thanks for your help
great !!
have a nice day.