Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Date1 | DayNo |
12/9/2010- Thu | 1 |
12/10/2010- Fri | 2 |
12/13/2010- Mon | 3 |
12/14/2010- Tue | 4 |
12/15/2010- Wed | 5 |
12/16/2010- Thu | 6 |
12/17/2010- Fri | 7 |
12/20/2010- Mon | 8 |
Thanks in advance.
Ranjit
Hi Ranjit,
try to use RowNo() to generate a progressive number.
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:
Date1 | rows |
12/9/2010 - Thu | 1 |
12/10/2010 - Fri | 2 |
12/13/2010- Mon | 5 |
12/14/2010 - Tue | 6 |
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
]
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
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
Hi Guys,
I am attaching my application, have a look at it and let me know what to do.
Thanks
Ranjit
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
try this:
if(weekday(Date)<5,autonumber(Date)) as DayNo