By using this website, you agree to our Terms of Use (click here)
Hi Tim,
I need a formula to print description of "Previous month". (Please check attached file "Month Calculation")
I can print current month and Year with the help of below formula:
= Report.GetPeriodDescription(@StartPeriod ) +'-' +Report.FormatYear(@StartPeriod) (O/p : January 2018)
but, I want to print previous month ( I tried same formula by adding -1...which is not working. After that I tried below formula which gives me output in numeric format
=Format( '{0: MMM - yyyy}', Report.FormatPeriod(@StartPeriod, -1) ) (O/P: 12-2017 ) [O/P should be Dec - 2017 or December 2017]
please give me some suggestion...
Thanks.

Try something like this:
=Format( '{0: MMM yyyy}', DateAdd( Report.GetPeriodEndDate(@StartPeriod), 'm', -1))
Thanks Royce for your immediate reply.
I tried this formula but anyhow value is not converting into the given format Format( '{0: MMM yyyy}'). *Attcahed file :Month formula 1

Ishan,
It's working in our reports, the only difference is for our reports the -1 is a 1, so it list months from current on wards.
Example:

These were generated with these formulas:
=Format( '{0: MMM yyyy}', Report.GetPeriodEndDate(@StartPeriod))
=Format( '{0: MMM yyyy}', DateAdd( Report.GetPeriodEndDate(@StartPeriod), 'm', 1))
=Format( '{0: MMM yyyy}', DateAdd( Report.GetPeriodEndDate(@StartPeriod), 'm', 2))
etc.
Ishan's screenshots weren't showing so I added them to his posts.
I usually use the same formula that Royce shared and it works fine for me too. Maybe try removing your commented line and put the Format function directly after the = to see if that makes a difference for some reason.
Hi Royce and Tim,
Yes...it's working .Thanks a lot guys.
