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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
tan_chungkam
Creator
Creator

Convert Number into Year and Week

Hi Qlikers,

How can I make Qliksense recognize numbers and Year and Week.

I have a column contain below number:

201852 Year 2018 Week 52

Thus when I add 1 week into the number, it should become 201901.

Labels (1)
3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I usually create a WeekStart field using the WeekStart() function:

WeekStart(MakeWeekDate( Left(MyYearWeekField,4), Right(MyYearWeekField,2))) as MyWeekStartField

Then to format it as the YearWeek number you can use the Dual function:

Dual(MyYearWeekField , WeekStart(MakeWeekDate( Left(MyYearWeekField,4), Right(MyYearWeekField,2)))) as MyWeekStartField

When you add 7 to a value of that field you get the next week since it's a date based field which has a unit of 1 day.

 


talk is cheap, supply exceeds demand
tan_chungkam
Creator
Creator
Author

Hi @Gysbert_Wassenaar,

When i added 7 into the YearWeek,

It should return figure like 43570,43591 and etc.

How to return theses figure to 201901, 201902

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

It should return figure like 43570,43591 and etc.

Should or does? If it does then YearWeek is already a date field and you can use the Dual function to apply the formatting:

Dual( Year(YearWeek)*100+Week(YearWeek), YearWeek  )


talk is cheap, supply exceeds demand