Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Future date(s) and variables

Hello all,

Hopefully someone can help me with my problem. I want to make a forcast of some data.

I have: DayNumbers, WeekNumbers, MonthNumbers and YearNumbers in my qvw.

I want to create a forcast for one week ahead (now week 34 so want to see week 35). This works for now, but how do I create this if week 52 OR 53 goes to week 1. How do I set the year number +1 ?

What I did:

Variable: vNextWeek / =Week(Today())+1

Set analysis: sum({$<Categories={'SLA'}, WeekNumber={$(=vNextWeek)}, Afdeling={'Infrastructure System'}, YearNumber={'2015'}>}Gewerkte_Uren)

Thanks for thinking with me.

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Maybe you shouldn't translate dates into year/month/week parts. Instead, stay with dates. The next week starts on WeekStart(Today()+7) and ends on WeekEnd(Today()+7). Those can be easily inserted as set analysis constraints.

Peter

View solution in original post

21 Replies
jduarte12
Partner - Creator II
Partner - Creator II

Hello.

Why don't you try to do something like:

if( week(today())<53, your set analysis, sum({$<Categories={'SLA'}, WeekNumber={1}, Afdeling={'Infrastructure System'}, YearNumber={'2016'}>}Gewerkte_Uren))

You could use your solution for the most part of the year and, in the last week, you would get the forecast for the first week of the following year.

Best regards,

João Duarte

Not applicable
Author

Thanks for your answer, this is something to consider, but then I need to update the qvw every year. My feeling says there must be a way to configure this and never look at it again.

Not applicable
Author

Hi

Why don't you try master calendar

jduarte12
Partner - Creator II
Partner - Creator II

Yes, for sure.

One I idea would be to make a similar step in the year part of the set analysis:

if( week(today())<53, your set analysis, sum({$<Categories={'SLA'}, WeekNumber={1}, Afdeling={'Infrastructure System'}, YearNumber={$('=year(today())+1'}>}Gewerkte_Uren))


Please check my set analysis for the year part, as I may have typed it wrongly.

Not applicable
Author

When I follow this guide: Creating A Master Calendarand use the right DateFields from my QVW am I at the right track?

sasiparupudi1
Master III
Master III

you could use YearNumber={$(=year(today()))}

or put year(today()) this into a variable

hth

Sasi

Not applicable
Author

This won't work when I run qlikview @ last week of December and then Week + 1 Then it wil do Week 1 of 2015, and I need week 1 of 2016

Not applicable
Author

I see where your going, but the answer of the if statement is always true, because the weeknumbers are always below 53. So it never gets to the last part of the statement, right?

jduarte12
Partner - Creator II
Partner - Creator II

Sorry.

I was meaning week 52; that should be the value on the set analysis I posted. If you run that set analysis on week 52 (the last week of a year), I think it should work.