Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
SamuelHaag
Contributor III
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
raman_rastogi
Partner - Creator III
Partner - Creator III

Hello,

try this

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

 

Thanks

Raman Rastogi

View solution in original post

1 Reply
raman_rastogi
Partner - Creator III
Partner - Creator III

Hello,

try this

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

 

Thanks

Raman Rastogi