Ist there a rule that can find a previous date?
For example on 28 Feb 2023 the previous date would be 31 Jan 2023.
Rule for previous date
- gtonkin
- MVP
- Posts: 1198
- 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
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).
These could be easily updated using TI and and spreadsheet send (with your workings for business/non-business days).
-
- Community Contributor
- Posts: 287
- 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
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.
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.
Code: Select all
TIMST(DAYNO('2023-02-28') - Day('2023-02-28'), '\D \M \Y');
If you're using TI, you can leverage the FormatDate to specify an input format and forgo converting the input to an acceptable format.