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: 
renjithpl
Specialist
Specialist

Assign Daynumber to working days

Hi All,

I have a Date field which includes saturday and sunday,

i have excluded saturday and sunday from Date using if(weekday(Date)<5,Date) as Date1,

Now i want a DayNo as 1, 2, ... Like below

Date1DayNo
12/9/2010- Thu1
12/10/2010- Fri2
12/13/2010- Mon3
12/14/2010- Tue4
12/15/2010- Wed5
12/16/2010- Thu6
12/17/2010- Fri7
12/20/2010- Mon8


Thanks in advance.

Ranjit

8 Replies
pljsoftware
Creator III
Creator III

Hi Ranjit,

try to use RowNo() to generate a progressive number.

renjithpl
Specialist
Specialist
Author

Hi Jonathan,

I used rowno(), but its giving the number for the Date field not for Date1 field.

when i select Date1 as dimension and expression as rowno() its ommitting the sat and sundays.

its showing like below:

Date1rows
12/9/2010 - Thu1
12/10/2010 - Fri2
12/13/2010- Mon5
12/14/2010 - Tue6


deepakk
Partner - Specialist III
Partner - Specialist III

hi Ranjith,

Since this values are fixed, we can use the inline method

Load

Date,

Weekday,

Value from Table

left join

Load * inline [

WeekDate, No

Thu, 1

Fri,2

Sat,3

... and so on

]

tresesco
MVP
MVP

If you put the condition in the WHERE clause like:

LOAD Date, RowNo() as DayNo Where weekday(Date)<5;

I think you would get the result. But mind it in that case your date field would not have Sat/ Sun days at all. If you want them you can map them by creating a common Date field.

Regards, tresesco



tresesco
MVP
MVP

Hello, One more thing i noticed your heading of the post now. you are about to calculate working days, right? why don't you use NETWORKDAYS() function? you would not even have to manually exclude Sun/Sat days.

Regards, tresesco

renjithpl
Specialist
Specialist
Author

Hi Guys,

I am attaching my application, have a look at it and let me know what to do.

Thanks

Ranjit

pljsoftware
Creator III
Creator III

Hello Ranjit,

I don't know if I understand your request but I have try to remove your 2th dimension and add an expression

NameExp: DayNo
Exp: RowNo()

So, I have a progressive in your table.

Regards

chematos
Specialist II
Specialist II

try this:

if(weekday(Date)<5,autonumber(Date)) as DayNo