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

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

11 Replies
Anonymous
Not applicable
Author

Hi Shraddha,

I posted the script text. Hope this helps too.

wim

Anonymous
Not applicable
Author

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;