Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
New Contributor III

Expression: Sum last 10 workdays

Hello,

how can I create an expression that adds up the Sales of the last 10 workdays?

Here are some example data we work with:

SalesDateWorkday
50025.09.20181
100026.09.20181
2027.09.20180
028.09.20180
68029.09.20181
70030.09.20181
80001.10.20181
70002.10.20181
100003.10.20181
3004.10.20180
505.10.20180
60006.10.20181

 

If the date is a workday, there is a 1 in the field Workday. If not there is a 0 (holiday or weekend). So the whole thing needs to be dynamic.

I tried something like this, but it's not dynamic enough and could leave out some days:

sum( {1<
Workday={"1"},
Date={"$(=date(today()-1,'DD.MM.YY'))"},
Date={"$(=date(today()-2,'DD.MM.YY'))"},
Date={"$(=date(today()-3,'DD.MM.YY'))"},
Date={"$(=date(today()-4,'DD.MM.YY'))"},
Date={"$(=date(today()-5,'DD.MM.YY'))"},
Date={"$(=date(today()-6,'DD.MM.YY'))"},
Date={"$(=date(today()-7,'DD.MM.YY'))"},
Date={"$(=date(today()-8,'DD.MM.YY'))"},
Date={"$(=date(today()-9,'DD.MM.YY'))"},
Date={"$(=date(today()-10,'DD.MM.YY'))"}
>}

Sales)

 

Thanks!

Labels (2)
1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: Expression: Sum last 10 workdays

Hello,

try this

=if(NetWorkDays(Date(Today())-10,Date(Date))>1,Sum(Sales),0)

 

Thanks

Raman Rastogi

View solution in original post

1 Reply
Highlighted
Partner
Partner

Re: Expression: Sum last 10 workdays

Hello,

try this

=if(NetWorkDays(Date(Today())-10,Date(Date))>1,Sum(Sales),0)

 

Thanks

Raman Rastogi

View solution in original post