Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

shane_spencer
Valued Contributor

Convert Dayname to Date or Number

I've got a field that's a mix of Dayname (Mon, Tue, etc) and Date i.e 27/04/2018.

I also have a variable for Week Ending i.e. 25/05/2018 would be Friday. 

I somehow need to convert the Dayname to a number i.e. Mon = 0, Tues = 1

(so that I can convert the day name into date using that variable. i.e. Variable -4 + Dayname = Date)

See attached QVD. How do I convert the Mon, Tues etc in Day/Date field to a number?

Tags (2)
1 Solution

Accepted Solutions
Highlighted

Re: Convert Dayname to Date or Number

Use Pick() and Match():

Match([Day/Date], 'Mon','Tue','Wed') // this will return 1, 2, 3 depending on the order. If 'Sun' is the first value, then Sun = 1

Then add this value to the variable and you will get the full date.

View solution in original post

3 Replies
Highlighted

Re: Convert Dayname to Date or Number

Use Pick() and Match():

Match([Day/Date], 'Mon','Tue','Wed') // this will return 1, 2, 3 depending on the order. If 'Sun' is the first value, then Sun = 1

Then add this value to the variable and you will get the full date.

View solution in original post

Highlighted
giovanneb
Contributor II

Re: Convert Dayname to Date or Number

Hello Shane, try this

Best regards !

Highlighted
shane_spencer
Valued Contributor

Re: Convert Dayname to Date or Number

Thanks. The nested If was exactly what I was trying to avoid though.