Rule for previous date

Post Reply
RonLat
Posts: 19
Joined: Tue May 02, 2017 7:49 am
OLAP Product: TM1, Planning Analytics
Version: 2.0
Excel Version: 365

Rule for previous date

Post by RonLat »

Ist there a rule that can find a previous date?

For example on 28 Feb 2023 the previous date would be 31 Jan 2023.
User avatar
gtonkin
MVP
Posts: 1192
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: Rule for previous date

Post by gtonkin »

I would suggest attributes for this as often you need prior day or prior business day.
These could be easily updated using TI and and spreadsheet send (with your workings for business/non-business days).
ascheevel
Community Contributor
Posts: 286
Joined: Fri Feb 15, 2013 5:49 pm
OLAP Product: TM1
Version: PA 2.0.9.1
Excel Version: 365
Location: Minneapolis, USA

Re: Rule for previous date

Post by ascheevel »

I second what George said. It seems you haven't fully shared the logic for your "previous date". If you want 2/28 to return 1/31, what should 2/27 return and 2/26, etc? Ignoring all of that, you could use the below code to have 2/28 return 1/31 in your specified output format via rules assuming you get your input date formatted properly.

Code: Select all

TIMST(DAYNO('2023-02-28') - Day('2023-02-28'), '\D \M \Y');
will return "31 JAN 2023". If you encapsulate the above in a CAPIT, it will return "31 Jan 2023"

If you're using TI, you can leverage the FormatDate to specify an input format and forgo converting the input to an acceptable format.
Post Reply