Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
In my dataset I've got a normal dates, so DD-MM-YYYY and time, but time is not important at all,
I would like to create a chart with weekly intervals
Ideally it would consist of dates such as
1/2/3/4 (as a number of week from given month).MM.YYYY
or
NumberOfWeek from entire year like 24.YYYY
Could you help me with that one?
Try creating the field with dual(), like:
Dual( Week(MyDate) & ' ' & 'Week' & Chr(13) & Year(MyDate),
Num(weekname(MyDate))
) as DualWeekYear
With this your DualWeekYear field should sort fine by default.
Try like:
Week(dateField)& '.' & Year(dateField) as WeekNumber
Looks good. Have you got any idea how to show it in chart, because its going to have 52-53 weeks and its really messy? Would help me a lot
Hi,
one solution for the "week of month" part of your question might be:
https://community.qlik.com/t5/QlikView-App-Dev/Week-creation/m-p/1054046/highlight/true#M929805
hope this helps
Regards
Marco
Hi Treseco,
Any idea how to order the weeks?
In my chart it looks like I got it mixed, like there is 7 week, then 9, then 50
I guess its because i applied strings to them?
Week(MyDate) & ' ' & 'Week' & Chr(13) & Year(MyDate)
It shows 7 Week 2021 for example and it became string I guess?
Hi Marco,
Thanks 🙂
Any idea how to order the weeks?
In my chart it looks like I got it mixed, like there is 7 week, then 9, then 50
I guess its because i applied strings to them?
Week(MyDate) & ' ' & 'Week' & Chr(13) & Year(MyDate)
so it shows for example 7 Week 2021
Try creating the field with dual(), like:
Dual( Week(MyDate) & ' ' & 'Week' & Chr(13) & Year(MyDate),
Num(weekname(MyDate))
) as DualWeekYear
With this your DualWeekYear field should sort fine by default.
You're life saver Tresesco!
What do you think about this quote
am concerned about the calculation of your week-year. In some situations the calendar year is not the same as the week's year.
Week(MyDate) & ' ' & 'Week' & Chr(13) & Year(MyDate)
Eg: January 1th 2021 is in Week 53 2020, but your calculation will return the year 2021.
Should I use Year or WeekYear in this calculation?
The quote - is rightly said. However, my take for this would be - that totally depends on what your business users think about it; how they would like to see the week number in such cases. In some business the broken week is fine where you can use lunar week too. Get input from them and user your expression that fits. 🙂