Best Practice to find Day of Week

Post Reply
User avatar
cdredmond
Posts: 23
Joined: Tue Sep 08, 2009 2:46 pm
OLAP Product: TM1
Version: SpreadsheetConnector4.0-10.2.2
Excel Version: v3 - 2013
Location: Tigard, OR (Portland, Oregon Metro area)
Contact:

Best Practice to find Day of Week

Post by cdredmond »

We have run into the need several times to know the day of the week and have created our own work around based on the situation.
Is there a best practice to identify the day of the week (e.g. Tuesday or Sunday) in TI and in Rules?
Christopher Redmond
Senior TM1 Consultant
http://www.bpmnw.com
Office: (503) 747-2614
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Best Practice to find Day of Week

Post by tomok »

I am not aware of any "best practice" but one way of determing the day of the week is to use the following formula:

MOD(DAYNO(TODAY),7);

If it returns 0 it is Friday (because 1/1/1960 was a Friday), 2 is Saturday, 3 is Sunday, and so on through 6. You can either do an IF, ELSEIF construct or put it in a lookup cube.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
lotsaram
MVP
Posts: 3706
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Best Practice to find Day of Week

Post by lotsaram »

Chris - i find the best way is to create a lookup cube, or even just an attribute of a system date dimension, containing various date information. This way you can easily return any date related information (day of week, month, financial period, period start date, period end date, days in month, days MTD, days YTD, etc, etc, etc) for any date not just the current date.

It is a very obvious and simple approach yet I am constantly asounded by the myriad of complex rules and date calculations in TI that I observe when all that is required is a simple lookup. All it takes is a small amount of forsight to create and prepopulate the required time lookup values.
Post Reply