Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I struggle to create a date field and could need your help.
Right now I don't have any date field but I have a dimension with weeks written in the following way: 1903, 1904, 1905, 1906... Were 19 stands for the year 2019 and 03 the week number.
How can I change this dimension to a date field ?
Thanks in advance,
You can construct a date from year, week and weekday using MakeWeekDate().
LOAD
MakeWeekDate(Year, Week, 0) as Date, //0= monday
*
;
LOAD
year(Date#(LEFT(YearWeek,2), 'YY')) as Year,
RIGHT(YearWeek,2) as Week
inline [
YearWeek
1903,
1904,
1905,
1906
];
Hi Mlan
Year and Weeks can be isolated this way, and will work until 2100.
'20'& num(left( dimension , 2 ),'00') as Year
num(right( dimension , 2 ),'00') as Week
How ever above is not a data field but fields with numeric values.
Br.
Teis
You can construct a date from year, week and weekday using MakeWeekDate().
LOAD
MakeWeekDate(Year, Week, 0) as Date, //0= monday
*
;
LOAD
year(Date#(LEFT(YearWeek,2), 'YY')) as Year,
RIGHT(YearWeek,2) as Week
inline [
YearWeek
1903,
1904,
1905,
1906
];