Here is a short overview:
# Calculate the weeknumber for a given date
# (Weeknumber does not contain the year but could be added too)
pDate = '2024-06-21';
# OPTION 1
nDate = DayNo( pDate );
v = Timst( nDate, '\Y-' ) | NumberToStringEx( nDate, 'ww', '', '' );
TextOutput( 'weeknumber.txt', v );
# OPTION 2
vDateFormat = 'yyyy-MM-dd';
nDate = ParseDate( pDate, vDateFormat );
v = FormatDate( nDate, 'w' );
TextOutput( 'weeknumber.txt', v );
# OPTION 3 - ISO weeknumber
# Refer to: https://www.tm1forum.com/viewtopic.php?t=16386
------------------------------
Wim Gielis
------------------------------
Original Message:
Sent: Sun June 16, 2024 05:28 AM
From: Jeremy Aude
Subject: Week Level in Time Dimension
Hello,
I am a newbie here to writing TI processes. The requirement is to store a snapshot of employee headcount weekly. The data source is a text file and there is no date in the file.
For time, my thought is to have a date dimension with year>quarter>month>week ( 1 through 52). Then I would use a variable to define the week of year based on the current date when the file is loaded. I can't figure out how to extract the week number from a date variable.
Has anyone done something similar? Any suggestions on how to determine the week based on current date? Maybe there's a better approach?
Thank you for your guidance!
------------------------------
Jeremy Aude
------------------------------