Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

weekday without weekend

I have a dimension in a chart that shows all the weekdays, hence, my dimesion is an expression weekday(Date).

But, i only want to display the workdays (Monday, Tuesday, Wednesday, Thursday , Friday). So exlude Saturday and Sunday.

What to do?

//A.

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Weekday(Date) returns week in characters like Mon/Tue/Wed etc.

So, use this in you Dimension

=If(WeekDay(Date) * 1 < 5, WeekDay(Date) )

As WeekDay(Date) * 1 return numeric week number like 0,1,2,..

Hope this helps you.

Regards,

Jagan.

View solution in original post

4 Replies
swuehl
MVP
MVP

Try maybe

=if(weekday(Date)<5, weekday(Date) )

as calculated dimension.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Weekday(Date) returns week in characters like Mon/Tue/Wed etc.

So, use this in you Dimension

=If(WeekDay(Date) * 1 < 5, WeekDay(Date) )

As WeekDay(Date) * 1 return numeric week number like 0,1,2,..

Hope this helps you.

Regards,

Jagan.

swuehl
MVP
MVP

Well, the Help says about weekday() function:

weekday( date )

Week day. Returns an integer between 0-6.

I personally believe it will return a dual, though. Anyway, my above line just works as is for me, limiting the weekdays to Mon-Fri only and displaying the dimension value as text, not numbers.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Yes, you are correct, but when checked this

=WeekDay(Today()) in Text object it is displaying Mon. then

I tried =WeekDay(Today())*1, it works fine.

I am currently using QV 9.0 SR2, I don't know whether it is fixed in future versions.

Regards,

Jagan.