Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
samuel_brierley
Creator
Creator

Expression isnt working

Hi the below formula isnt working.

if(Date <= [Period 2 Start Date], 2,1)

regardless if i put < or > it still results in 1's?

thanks for any help

7 Replies
Not applicable

did you check if both field have the same dateformat?

Anonymous
Not applicable

Samuel

Are both your fields Date and [Period 2 Start Date] in the same format ?

You could try forcing them both to numeric :

     if(num(Date) <= num([Period 2 Start Date]), 2,1)


Best Regards,     Bill

alexandros17
Partner - Champion III
Partner - Champion III

When you manage date transform them with num

if(Num(Date) <= Num([Period 2 Start Date]), 2,1)

hope it helps

Not applicable

hi

try this

if(num(Date(Date)) <=num( Date([Period 2 Start Date])), 2,1)

samuel_brierley
Creator
Creator
Author

Yes they are both Date#(.....,'DD/MM/YYYY')

samuel_brierley
Creator
Creator
Author

all of my date fields where auto picked up by qlikview as dates but the Period 2 Start date wasnt so in the script i put

Date#([Period 2 Start Date],'DD/MM/YYYY')as [Period 2 Start Date],

that didnt help so i went back and did that to all Date fields but after i did that the old date fields that where already correctly formatted by qlikview now result in a number?majorly confused now?

Not applicable

You must use:

Date(Date#([Period 2 Start Date],'DD/MM/YYYY'),'DD/MM/YYYY')as [Period 2 Start Date]