Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
amien
Specialist
Specialist

networkday() question

=DATE(DATE#(RIGHT(datum,8),'YYYYMMDD')-3,'D-M-YYYY')

this give me a date 3 days back .. i need 3 workdays back.

I'v read the networkdays() in the reference manual. But then i need a second date (which i dont have)

is there another option?

14 Replies
amien
Specialist
Specialist
Author

customfirstworkdate is basicly the same as customnetworkdays.. only



SET customnetworkdays = 'networkdays($1,$2';
FOR I = 0 TO noofrows('Holidays')-1
LET customnetworkdays = customnetworkdays & ',' & num(peek('Holiday',I,'Holidays'));
NEXT I
LET customnetworkdays = customnetworkdays & ')';


johnw
Champion III
Champion III

OK, looks like at least my explanation of the problem appears to have been correct. When I build your new "function" and use it, it does indeed hack off the expression right before the formatting.

However, removing the formatting like I suggested fixes it in my file. I built the function, and I'm doing this:

$(customnetworkdays('1/1/2010',min(Date)))

It's returning 46 for a min(Date) of March 5, 2008, which is before any of my custom holidays. Seems like the right number. I'm going to add in Jan 1 and Feb 15 as holidays. The number drops to 44, as expected.

So... I guess I don't know what's going wrong in your version. Attached is my updated file. Hopefully you can figure it out from there. If not, can you post a sample file demonstrating the problem?

amien
Specialist
Specialist
Author

i'm working with this:

[Dates]:
LOAD * INLINE [
Date
20100305
20100312
20100317
];

When [Dates] have the correct notation .. then its working.

amien
Specialist
Specialist
Author

<double post>

amien
Specialist
Specialist
Author

John,

i added the DATE(Date#) as additional field in my load script .. works fine .. thanks!