Created
November 16, 2017 08:32
-
-
Save ralfbecher/23bea83cb5b22281e1150c2c71824fd5 to your computer and use it in GitHub Desktop.
Qlik Master Calendar Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kalender: | |
Load | |
TempDate AS [Issue Datum], | |
Year(TempDate) As Jahr, | |
Month(TempDate) As Monat, | |
monthname(TempDate) as [Monat Jahr], | |
Day(TempDate) As Tag, | |
'Q' & ceil(month(TempDate) / 3) AS Quartal, | |
'Q' & ceil(month(TempDate) / 3) & ' ' & Year(TempDate) AS [Quartal Jahr], | |
Dual('KW' & Week(weekstart(TempDate)), Week(weekstart(TempDate))) as Woche, | |
Dual('KW' & Week(weekstart(TempDate)) & ' ' & WeekYear(TempDate), weekstart(TempDate)) as [Woche Jahr], | |
WeekDay(TempDate) as WeekDay | |
; | |
//=== Generate a temp table of dates === | |
LOAD | |
date(mindate + IterNo()) AS TempDate | |
,maxdate // Used in InYearToDate() above, but not kept | |
WHILE mindate + IterNo() <= maxdate; | |
//=== Get min/max dates from Field ===/ | |
LOAD | |
min(FieldValue('Issue Datum', recno()))-1 as mindate, | |
max(FieldValue('Issue Datum', recno())) as maxdate | |
AUTOGENERATE FieldValueCount('Issue Datum'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment