Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
avermalla
Contributor
Contributor

Nested if with And issue

Hi

I am creating a Calculated Field when uploading data through Data Manager in Qlik Sense

the formula for the calculated field is as follows:

if(FlgtHour<=10,'1st Wave',

If(FlgtHour>10 and FlgtHour<=16,'2nd Wave', 'Final Wave'))

If I don't have the 'and' keyword in the second expression it works - as soon as I incorporate the 'and' it fails.

Does the 'and' not work when creating a calculated filed in Data Manager?

Its driving me ....

Thanks

1 Solution

Accepted Solutions
sunny_talwar

I would think it should... but you can just do this

If(FlgtHour<=10,'1st Wave',

If(FlgtHour<=16,'2nd Wave', 'Final Wave'))

Because if FlgtHour is less than 10, it will just get picked in 1st Wave, you don't really need to add the first part of the condition

View solution in original post

6 Replies
sunny_talwar

I would think it should... but you can just do this

If(FlgtHour<=10,'1st Wave',

If(FlgtHour<=16,'2nd Wave', 'Final Wave'))

Because if FlgtHour is less than 10, it will just get picked in 1st Wave, you don't really need to add the first part of the condition

avermalla
Contributor
Contributor
Author

Hi Sunny

Thanks it did work - however in this case the options were quiet simple - but why is the add not working in Data Upload. It works in all other expressions in the front end its only an issue in 'Data Upload - Calculated field'

sunny_talwar

In the if statement you posted above, I don't see any problem... would you be able to show us the error message?

luismadriz
Specialist
Specialist

Hi, I just tried this myself and Arvind is correct, the expression editor when creating a calculated field via Data Manager is limited and very controlled. The interface is a bit different to the expression editors we have in Qlik Sense. I tested it on the Cloud so it's the latest version

Whenever I tried to do something simple like IF(C>10 OR C<5,'Yes','No') the expression just didn't work and the ANDs or ORs weren't recognised. 

Strange...

Luis

sunny_talwar

I was not aware of this new place where you can add this if statement

Bisanta
Contributor
Contributor

Hey, Just wondering if there has been any fix for this. It will be nice to have the AND/OR enabled with conditional IF when creating a calculated field. Sometimes, conditions to derive a new field could be tricky.