Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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

Re: Future date(s) and variables

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

21 Replies
jduarte12
Contributor II

Re: Future date(s) and variables

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

Re: Future date(s) and variables

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

Re: Future date(s) and variables

Hi

Why don't you try master calendar

jduarte12
Contributor II

Re: Future date(s) and variables

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

Re: Future date(s) and variables

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

sasiparupudi1
Honored Contributor III

Re: Future date(s) and variables

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

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

hth

Sasi

Not applicable

Re: Future date(s) and variables

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

Re: Future date(s) and variables

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
Contributor II

Re: Future date(s) and variables

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.

Community Browser