Former Member

# Previous Month/year Calc?

I have [Report Month] = [1,2,3,4,5,6,7,8,9,10,11,12] & [Report Year] =[2011,2012,2013,2014,2015,2016] fields returned from database

I want to calculate 'Previous Month' based on the [Report Month]

How do I calculate so that the situation of Report Year = 2016 and Report Month = 01(Jan) where now the Previous Month is '12' of 2015

10|10000 characters needed characters exceeded

### Related questions

Posted on Apr 20, 2016 at 09:33 PM

Hi Vishal,

What are the datatypes of those fields [Report Month] and [Report Year]? Number or String? That's required to create the accurate formula.

If their datatype is number, then try using the below formulas:

Previous Report Month = If([Report Month]=1) Then 12 Else ([Report Month]-1)

Report Year of Previous Report Month = If([Report Month]=1) Then ([Report Year]-1) Else [Report Year]

If you see a "," (comma) in the Year, just wrap it with formatnumber() as =Formatnumber([];"####")

Thanks,

Mahboob Mohammed