Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
ashis
Creator III
Creator III

Nested If condition

Hello ,

I have two fields and I am calculating GMT with the following command

Table1:

StartTimeReportUserTimeZone,,

StartTimeReport,

time#(interval(time(StartTimeReportUserTimeZone, 'hh:mm') - time(StartTimeReport, 'hh:mm'), 'h:mm'),'h:mm') as GMTID

from table1;


LOAD *,

if(GMTID='1:00','London',if(GMTID='2:00', 'Europe',if(GMTID='5:30','India', if(GMTID='8:00', 'Hongkong' ,if(GMTID='-4:00', 'Canada','NA'))))) as Location

resident table1;

drop table table1;

problem is when the value is -4:00 the location Cananda is not showing .

is something problematic where I am calculating GMTID. for all other values it is working fine.

Please advise.

1 Solution

Accepted Solutions
tomasz_tru
Specialist
Specialist

Maybe try Pick(Wildmatch()) combination?

View solution in original post

8 Replies
tomasz_tru
Specialist
Specialist

Maybe try Pick(Wildmatch()) combination?

Anil_Babu_Samineni

May be try with this?

LOAD *,

if(GMTID='1:00','London',if(GMTID='2:00', 'Europe',if(GMTID='5:30','India', if(GMTID='8:00', 'Hongkong' ,if(Fabs(GMTID)='4:00', 'Canada','NA'))))) as Location

resident table1;

This should work, But not exactly rule of the scenario. Will you provide sample ?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Chanty4u
MVP
MVP

try here fabs

,if(fabs(GMTID='-4:00',

Chanty4u
MVP
MVP

Chanty4u
MVP
MVP

if it is not time you can try below way

=IF(Column(1)<0 and Column(2)<0,(Column(1)/Column(2))*-1,(Column(1)/Column(2)))

ashis
Creator III
Creator III
Author

Nope , it did not work

ashis
Creator III
Creator III
Author

It is time.

ashis
Creator III
Creator III
Author

Thank you, it worked, is it a good idea to do wildmatch here since I am matching GMT value? please advise