Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

create a monthcounter

Hi Folks,

i have one question, namely regarding a mothcounter in master calender, i want to have a numbered consecutively lilke

Jan, Feb, Mrz. Apr, although Jan = 0, Feb= 25,

in my example (see attached) my orders begins with Month: Feb,

for this issue, i use this code:

QuarterMap:

Mapping LOAD

RowNo() as Month,

'Q' & Ceil(RowNo()/3) as Quarter

AutoGenerate (12);

Temp:

LOAD

min(Datum) as minDate,

max(Datum) as maxDate

Resident main;

Let varMinDate = num(Peek('minDate',0,'Temp'));

Let varMaxDate = num(Peek('maxDate',0,'Temp'));

DROP Table Temp;

TempCalendar:

LOAD

$(varMinDate) + IterNo()-1 as Num,

Date($(varMinDate)+IterNo()-1) as TempDate

AutoGenerate 1 While $(varMinDate) + IterNo()-1 <= $(varMaxDate);

[Master Calendar]:

LOAD

    TempDate as Datum,

    AutoNumber(TempDate) as MonthCounter,

    Week(TempDate) as Week,

    Year(TempDate) as Year,

    Month(TempDate) as Dim_Month,

    Day(TempDate) as Day,

    ApplyMap('QuarterMap',month(TempDate),Null()) as Quarter,

    Week(WeekStart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,

    WeekDay(TempDate) as WeekDay

Resident TempCalendar

Order By TempDate ASC;

Drop Table TempCalendar;

how can i resolve this issue? Thanks a lot in advance

beck

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

2 Replies
sunny_talwar
MVP
MVP

Sort numerically

Capture.PNG

beck_bakytbek
Master
Master
Author

Thanks a lot Sunny