Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am looking to use variables to restrict data shown in straight tables, pivot tables and bar graphs.
Currently I set the following:
vCurrentMonth=MonthName(today())
vCurrentMonthLess1=vCurrentMonth-1
vCurrentMonthLess2=vCurrentMonth-2
I then set the document properties number format to Date MMM YYYY
This produces the following data:
vCurrentMonth = Dec 2013
vCurrentMonthLess1 = Nov 2013
vCurrentMonthLess2 = Nov 2013 (Not sure why this doesn't return Oct 2013)
Also when I try to use the vCurrentMonthLess1 as a variable in the straight table it returns a number 41608 rather than Nov 2013.
Does anyone have any idea what I am doing wrong?
Thanks for your help.
Regards,
Daniel
If you look up the Monthname function in the help file you will see that it returns a date as underlying value. The month name is merely the display format. Monthname(today()) returns the date december 1st. If you subtract 1 from that you get november 30. If you subtract another day from that you get november 29. What you can do instead is use addmonths(vCurrentMonth, -1) and addmonths(vCurrentMonth, -2)
Try this:
vCurrentMonth=MonthName(today())
vCurrentMonthLess1=MonthName(today(),-1)
vCurrentMonthLess2=MonthName(today(),-2)