Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.02.89.41/Calculate-dd_2D00_mm_2D00_yyyy-Plus-X-days-_2D00_-2010103002.qvw]
Hi guys,
I Need help to work around the present situation (please see the attachment):
I need to calculate Target Date as StartDate + ExtraDays when IsWorkDay=1.
In example:
If StartDate = 30/09/2010 (see Line No 15)
So, Target Date should be 04/10/2010
LineNo | StartDate | Day | IsWorkDay | ExtraDays |
15 | 30/09/2010 | Thu | 1 | 3 |
16 | 01/10/2010 | Fri | 0 | |
17 | 02/10/2010 | Sat | 0 | |
18 | 03/10/2010 | Sun | 1 | |
19 | 04/10/2010 | Mon | 1 | |
20 | 05/10/2010 | Tue | 0 | |
21 | 06/10/2010 | Wed | 1 |
Thanks in advance,
Aldo.
Hi John,
I tried the second script, but it works with errors. I believe is related to the work date secuence. I am trying to fix the script, but I don't understand all the details.
What's the meaning of "LEFT JOIN (BaseDates)", and since there is no Resident /From, where is getting the data from?
The table below, is joining to Which table?
LOAD
LineNo
,StartDate
,ExtraDays
,rangesum(peek(WorkDateSequence),IsWorkDay) as WorkDateSequence
RESIDENT BaseDates
ORDER BY StartDate;
Thanks again,
Aldo.
Ah, your table is BaseDates1 instead of BaseDates. So just change all my BaseDates to BaseDates1. Then it works.
When one load with no resident/from comes before another, it's called a preceeding load. The source of the first load is the second load. It is loading from another load. That also answers your other question, which is that the load you copied in your post isn't going directly into ANY table, it's just the source for the load above it.
Yeap, it works!
Thanks again,
Aldo.