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: 
Anonymous
Not applicable

Last day of week - Set analysis

Hi,

I have a set of inventory data. I would like to create a chart or table that shows inventory status on the last day of the week. So If I would choice weeks from nr.1 to nr.10 it would sum the inventoryvalue for the last day of all the weeks. Is this possible with set analysis?

The data looks something like this.

InvTrans:

LOAD * INLINE [

Date, Product,Store,Qty,EntryType

2017-02-28, 1,1,100,0

2017-03-01, 1,1,-10,1

2017-02-28,2,2,100,0

2017-03-03, 2,2,-10,1

2017-03-02, 1,1,100,2

2017-03-02,2,2,500,2

2017-03-04,1,2,-50,1

];

Any hints greatly appreciated.

Regards

Birkir

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like

=Sum({<Date = {"=WeekDay(Date)=6"}>} Qty)

But it would be good to create a flag in your script that flags dates that fulfill your requirement:

LOAD

     Date,

     If(WeekDay(Date) =6,1,0) as LastWeekDayFlag,

     ...

then

=Sum({<LastWeekDayFlag = {1} >} Qty)

View solution in original post

3 Replies
swuehl
MVP
MVP

Maybe like

=Sum({<Date = {"=WeekDay(Date)=6"}>} Qty)

But it would be good to create a flag in your script that flags dates that fulfill your requirement:

LOAD

     Date,

     If(WeekDay(Date) =6,1,0) as LastWeekDayFlag,

     ...

then

=Sum({<LastWeekDayFlag = {1} >} Qty)

Anonymous
Not applicable
Author

Hi Stefan,

Thank you for the help. This works like a charm, I think I will use the LastWeekDayFlag.  Would this be a good idea or practice to put it into a mastercalendar load?

Regards

Birkir

swuehl
MVP
MVP

Yes, that's what I would do.