Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
MonthName()'s return is formatted according to the MonthNames script variable.
Is there a similar way to format WeekName()'s return, as YYYY/WW does not suit me (I'd like something like WW-YYYY)
Thank you !
Try this:
dual(num(Week(DateField), '00')&'-'& WeekYear(DateField), WeekName(DateField)) as WeekName
I'll wait for the other feedback as too.
but to my knowledge there is no such formatting.
so transforms into text:
=week('12/01/2013')&'-'&year('12/01/2013')
Try this:
dual(num(Week(DateField), '00')&'-'& WeekYear(DateField), WeekName(DateField)) as WeekName
I reccomend you to use yearweek() not year() when creating week names. Using Year() will give you trouble on certain dates. Consider the example below:
=week('01/01/2017')&'-'&year('01/01/2017')
Will return '52-2017' indicating it is in the end of 2017 which its not.
=week('01/01/2017')&'-'&weekyear('01/01/2017')
Will return '52-2016' which is a more correct name for this date.
Well said, thank you very much.
I'm still learning 😊
We all are and the Qlik Community is a really good place to learn.
Thank you for contributing.
@Vegar wrote:Try this:
dual(num(Week(DateField), '00')&'-'& WeekYear(DateField), WeekName(DateField)) as WeekName
I have that in some places of my scripts, but I noticed that sometimes this is being interpreted by qlik as a substraction, and gives weird results.
I just checked out what 'dual()' is, and this is brilliant. I believe it fixes the problem.
Thank you very much !