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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
martin_hamilton
Creator
Creator

daynames function

Hi

I am imported data which has a string column which has the days of the week included in it e.g. MON, TUES, WEDS, etc

How do I convert on a load so I can sequence them in order.

I have seen the daynames function mentioned but dont quite understand how it would work in this instance - if at all?

Many Thanks

Martin

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be using a mapping load

MappingLoad:

Mapping

LOAD * INLINE [

Day, Sequence

MON, 1

TUE, 2

WED, 3

THU, 4

FRI, 5

SAT, 6

SUN, 7

];

and then

Fact:

LOAD DayName,

           ApplyMap('MappingLoad', DayName, Null()) as Sequence

           ....

FROM ....;

View solution in original post

4 Replies
el_aprendiz111
Specialist
Specialist

Hi,

ORDER:
load
DUAL ( Day,Order ) as DayOfWeek

inline
[ Day,Order
Monday,0
Tuesday,1
Thursday,3
Friday,4
Saturday,5
Sunday,6
Wednesday,2
]

DayOrder.png

sunny_talwar
MVP
MVP

May be using a mapping load

MappingLoad:

Mapping

LOAD * INLINE [

Day, Sequence

MON, 1

TUE, 2

WED, 3

THU, 4

FRI, 5

SAT, 6

SUN, 7

];

and then

Fact:

LOAD DayName,

           ApplyMap('MappingLoad', DayName, Null()) as Sequence

           ....

FROM ....;

sergio0592
Specialist III
Specialist III

You probably have a date field in your data, so use weekday() function:

Orders:

LOAD

*,

WeekDay(Date) as Day

INLINE [

Date, Orders_nb, owner,foreign

01/04/2017,234,C,0

02/04/2017,300,C,1

03/04/2017,867,B,0

04/04/2017,908,A,0

];

and sort Day with numeric value

martin_hamilton
Creator
Creator
Author

Thanks Sunny - just what I needed. Unfortunately I have no dates in my data apart from minutes in the week to determine the day of the week so calculated that before i loaded but didnt think of placing a sequence in it at the same time.