Skip to Content
author's profile photo Former Member
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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.