Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Highlighted
Not applicable

Qlikview and week 53 year 2016?

Hello!

I am having a big trouble with my QlikView viz.

The viz is showing now weekly based trendlines and we are compering lines between years.

The problem is that the year 2016 line continues all the way to the week 53, that obviously has not yet reached for this year.

This is some ISO-date problems within the program.. Is there any solutions how this can be fixed?

I am using the QlikView Mastercalendar code to generate dates based on my own datefield.

week.png

The orange line is the problem here... The straight line from week 11 to the week 53 should not be there.

Cheers,

Niko

1 Solution

Accepted Solutions
MVP
MVP

Re: Qlikview and week 53 year 2016?

Hi Niko,

I think you should also use a WeekYear field in your set expression field modiifer then:

=if(isNull(GetFieldSelections(Year)),sum({<WeekYear2={"$(vMaxYear)"}, Week=>} Value), sum({<WeekYear2={$(=Max(Vuosi))}, Week=>} Value))

Maybe your GetFieldSelections should also check on a WeekYear field, not sure what this expression should actually do.

14 Replies
MVP
MVP

Re: Qlikview and week 53 year 2016?

I think you should use a year field for your graph created with WeekYear() function, instead of just Year():

weekyear(date)

The year to which the week number belongs. The week number ranges between 1 and approximately 52. Some years week #1 starts in December, e.g. December 1997. Other years start with week #53 of previous year, e.g. January 1999. For those few days when the week number belongs to another year, the functions year and weekyear will return different values.

Examples:

weekyear( '1996-12-30' ) returns 1997.

weekyear( '1997-01-02' ) returns 1997.

weekyear( '1997-12-30' ) returns 1997.

weekyear( '1999-01-02' ) returns 1998.

Not applicable

Re: Qlikview and week 53 year 2016?

Hello,

Thank you for your input, I will look on to that.

I currently have two dimensions for time and they are as follows in this order:

=if(len(WeekYear)=6,left(WeekYear,1),left(WeekYear,2))

=right(WeekYear,4)

And the WeekYear is a field from the MasterCalendar.




Cheers,

Niko

MVP
MVP

Re: Qlikview and week 53 year 2016?

How is WeekYear created in the script, i.e. is the Year based on Year(Date) or WeekYear(Date)?

Not applicable

Re: Qlikview and week 53 year 2016?

Hello,

It is generated like Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,

Cheers,

Niko

MVP
MVP

Re: Qlikview and week 53 year 2016?

I can't reproduce the issue with some simple data, the line only gets to week 53 in year 2016 when the 'standard' year is used.

Could you upload a small sample QVW?

edit: Attached my sample.

Not applicable

Re: Qlikview and week 53 year 2016?

Hmm, thank you for your sample workbook.

I am also having 3 different expressions on my chart, may that 'cause the false line on the chart?

This is expression for the line that shows two years back:

=if(isNull(GetFieldSelections(Year)),sum({<Year={"$(vMaxYearMinus2)"}, Week=>} #1), sum({<Year={$(=Max(Year-2))}, Week=>}#1))

I have these expressions 3 times, for each "year". Current, current-1 and current-2.

And this is for that the lines will dynamically change when user makes selections. And as a default we show the value with variable.

Maybe not the best way to do it, but it works for the purpose

Cheers,

Niko

Not applicable

Re: Qlikview and week 53 year 2016?

Yep, when I removed the 3 custom expressions, it showed the year 2016 without the long line to the week 53.

But this removes my filtering for 3 top years ...

Cheers,

Niko

Not applicable

Re: Qlikview and week 53 year 2016?

Well actually when selecting year 2016 from the filters, it will show a dot on the timeline for week 53 alltho' it is colored for year 2015. Odd.

Cheers,

Niko

MVP
MVP

Re: Qlikview and week 53 year 2016?

Could you update my sample file that it matches your setting and demonstrates your issue?

Then upload it to this thread, please.