Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Question on Year(Date)

Hi,

I'm trying to use the calendar Master script to create the Year dimension for my data set.

However, i am not sure why some of the year appears as '-' (see Row 7).

Am i doing something wrong? Or do need to first format my date field upon loading?

RowYearsum(Value)
Row 12009279.49
Row 220100.00
Row 32011191,826.79
Row 420128,593.27
Row 52013101,875.40
Row 620142,015,958.22
Row 7-5,142,751.10

SDate is the date field I am using.

CalendarMaster:

LOAD

    Date(SDate) AS SDate,

    Year(SDate) AS Year,

    'Q' & Ceil(Month(SDate) / 3) AS Quarter,   

    Month(SDate) As Month,

    Day(SDate) As Day,

    Week(SDate) As Week;

Load Date(MinDate + IterNo() -1 ) AS SDate While (MinDate + IterNo() - 1) <= Num(MaxDate);

Load

    Min(SDate) AS MinDate,

    Max(SDate) AS MaxDate

RESIDENT FactSales;

thanks

Derrell

13 Replies
Anonymous
Not applicable
Author

thanks Daniel.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I think your master calendar script is OK - I think the problem is that some of your transaction dates have a time component, while the master calendar has only days (integer). This means that the transaction dates do not map into the master calendar and the '-' year value is 'missing'.

Make sure that the transaction dates have no time component - in the load statement that loads the value field, make sure the date is defined something like:

     Date(Floor(SDate)) As SDate,

You don't need the Floor in the calendar because you are working with integers already.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
danieloberbilli
Specialist II
Specialist II

Actually, I agree with the posting of Jonathan Dienst   - you should definitely try this out. I just saw that I was wrong regarding interpretation of the date fields (which would be actually done with date#().

Kind Regards from Flinders Street...good to see some people from Melbourne here

Anonymous
Not applicable
Author

Thanks, Jonathan. Works like a charm!