Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

wim_embrechts
New Contributor III

Weeknumber not associated with measure

Hi,

In the script in a Calendar I created a previous week dimension.

load

*,

num(Datum) as DateNum,

date(Datum) as Date,

year(Datum) as Year,

month(Datum) as Month,

day(Datum) as Day,

num(month(Datum) ) as MonthNum,

    Weekday(Datum, 0) as Weekday,

    floor(monthstart(Datum)) as YearMonthStartNum,

    week(Datum) as Weeknr,

    week(now())-1 as PreviousWeeknr

resident AllDates;

In the app the previous weeknummer is showing correctly but the measure isn't.

The measure is just a very simple sum of answered calls: sum(Answered)

Although the previous weeknumber is showing correctly, the measure is showing the complete total for all weeks and all years and not only the sum for the previous week. I also tried week(Today())-1 but it didn't work either

I'm not having this problem with Month, Year, Weekday...

Does anyone can advice me on this?

Thanks

1 Solution

Accepted Solutions
wim_embrechts
New Contributor III

Re: Weeknumber not associated with measure

solved by adding some new code:

CheckPreviousWeekFlag:

load

*,

    week(Datum)-1 as PreviousWeekNew

    where CheckFlagPreviousWeek = 1;

   

load

*,

    if(week(Datum) = week(today())-1,1,0) as CheckFlagPreviousWeek;

11 Replies
shraddha_g
Honored Contributor III

Re: Weeknumber not associated with measure

Create WeekStart in your Calendar

and for Previous week you can use WeekStart -7 .

If possible share sample app

wim_embrechts
New Contributor III

Re: Weeknumber not associated with measure

Hi Shraddha,

Thanks for your suppport.

In the Calendar (script) I created the following dimensions:

    Weekstart(Datum) as WeekStart,

    Weekstart(now())-7 as PreviousWeekStart

But as you can see, the dimension is also returning the total sum of all calls for all months and all years and not only for the last week.

Knipsel.JPG

regards,

Wim

arulsettu
Honored Contributor III

Re: Weeknumber not associated with measure

try this

Week(WeekStart(now())-1)

agigliotti
Honored Contributor II

Re: Weeknumber not associated with measure

what are the dimensions and measures are you using in that table object ?

shraddha_g
Honored Contributor III

Re: Weeknumber not associated with measure

Previous WeekStart should be

date(Weekstart(Datum) -7)  as PreviousWeekStart

Also share Sample app if possible. There might be some issue with linking data to calender

sasiparupudi1
Honored Contributor III

Re: Weeknumber not associated with measure

Try

WeekStart(Today(),-1)

wim_embrechts
New Contributor III

Re: Weeknumber not associated with measure

Hi all,

I added the qvf.

regards

wim

arulsettu‌; agigliottisasiparupudi1shraddha.g

wim_embrechts
New Contributor III

Re: Weeknumber not associated with measure

Hi Arul,

The total remains the same. I posted the script text.

wim

wim_embrechts
New Contributor III

Re: Weeknumber not associated with measure

Hi Sasidhar,

Thanks for your support. Unfortunately the result remains unchanged. I posted the script data.

regards

wim