Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

gerhardl
Contributor II

New "Day of the Week" field

Hi,

I currently have a field in my table called [Effective Date].

I would like to add a new field called [Effective Day], where:

2011/04/11 = Monday

2011/04/12 = Tuesday, etc.

This way I can break my marketing report down to specific days of the week, as opposed to just dates.

My scripts currently contains this:

DATE(DATE#( [Effective Date], 'DD-MMM-YY')) as [Effective Date],

Thanks,

Gerhard

Tags (2)
1 Solution

Accepted Solutions
dvqlikview
Honored Contributor II

New "Day of the Week" field

Muncho - I guess you are refering to the load script...

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

If this is right, then you can use this function

=Weekday(Now()) to return today's day

You will see the result as Thu

However if you change the assignment of DayNames variable in Load Script. Something like this...

SET DayNames='Monday;Tue;Wed;Thursday;Fri;Sat;Sun';

=Weekday(Now()) will return Thursday instead Thu.

I hope this makes sense to you. We are assigning the format with the SET Keyword in the load script.

Cheers!

12 Replies
MVP
MVP

New "Day of the Week" field

you have to use WEEKDAY() function.

Regards, tresesco

gerhardl
Contributor II

New "Day of the Week" field

Hi Tresesco,

Could you please explain to me how to incorporate it into my script, using the part of my script I posted above?. Every function or expression I'm using in QV I am using for the first time.

Very much appreciated,

G

Not applicable

New "Day of the Week" field

Hello Im also new in QV.

in QV help it says:

weekday( date )
Week day. Returns an integer between 0-6.

Example:
weekday( '1971-10-30' ) returns 5.

I think after that you can use mapping load to give week names.

sushil353
Honored Contributor II

New "Day of the Week" field

hi

weekday() function is the best solution..create a new field weekday(date) as day_name

Regard

dvqlikview
Honored Contributor II

New "Day of the Week" field

Please use this one in your load script.

WeekDay(DATE(DATE#( [Effective Date], 'DD-MMM-YY'))) as [Effective Week Day]

Not applicable

New "Day of the Week" field

Well i tried to use $(DayNames) to give week names but i cant ^^. Someone pls tell me how to use this.

dvqlikview
Honored Contributor II

New "Day of the Week" field

Muncho - I guess you are refering to the load script...

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

If this is right, then you can use this function

=Weekday(Now()) to return today's day

You will see the result as Thu

However if you change the assignment of DayNames variable in Load Script. Something like this...

SET DayNames='Monday;Tue;Wed;Thursday;Fri;Sat;Sun';

=Weekday(Now()) will return Thursday instead Thu.

I hope this makes sense to you. We are assigning the format with the SET Keyword in the load script.

Cheers!

Not applicable

New "Day of the Week" field

Well Weekday() will return integer right? 0 to 6. And i tried to turn this numbers to week names.

Or this weekday() will return week names?

Not applicable

New "Day of the Week" field

Hi

If you have

Set LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';

in the script

then

=date(today(),'WWWW')

is Thursday

Regards

Anders