Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
QlickySense
Creator
Creator

Make a weekdate, weekly intervals

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?

Labels (3)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

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.

 

 

View solution in original post

9 Replies
tresesco
MVP
MVP

Try like:

Week(dateField)& '.' & Year(dateField) as WeekNumber

QlickySense
Creator
Creator
Author

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

tresesco
MVP
MVP

  • Either have a bigger chart (more space for the chart), or
  • Enable scroll, or
  • Instead of showing 52 weeks data points - show less data points, may be monthly 
MarcoWedel

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

QlickySense
Creator
Creator
Author

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?

QlickySense
Creator
Creator
Author

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

tresesco
MVP
MVP

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.

 

 

QlickySense
Creator
Creator
Author

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?

tresesco
MVP
MVP

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. 🙂