Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

...

Info

NOTE: If the source Datetime value does not include a valid input for this function, a missing value is returned.

D s lang vs sql

Known Issue:

The current implementation of the WEEKNUM function returns a maximum value of 52. However, in some years, such as 2020, there is a 53rd week. You can add steps similar to the following to work around this issue:

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type: single value: dateformat(date(year(myDate), 1, 1), 'yyyy\/MM\/dd') as: 'NewYearsDayforMyYear'

derive type: single value: dateformat(date(year(myDate), 1, 1), 'yyyy\/MM\/dd') as: 'NewYearsDayforMyYear'

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type: single value: if(datedif(NewYearsDayforMyYear, myDate, day) > (52 * 7), 53, weeknum(myDate)) as: 'weekNumforMyDate'

derive type: single value: if(datedif(NewYearsDayforMyYear, myDate, day) > (52 * 7), 53, weeknum(myDate)) as: 'weekNumforMyDate'

...

Info

NOTE: Depending on the locale where the calculation of this function is performed, the maximum number of weeks in a year may be 52 or 53. It's possible that you could see different results in your browser,

D s photon
, and other running environments due to locale. For more information, see Locale Settings.


D s
snippetBasic

Column reference example:

...