Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld starts MONDAY! last chance to register is now ! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jujurier
Contributor II
Contributor II

Problem with "if" in load script

Hello everyone,

I'm encountering a strange issue while working on a loading script.

I have this field:

POPULATION

234

1549

349

54983

I want to create two fields, let's call them B and C. Both are used to generate population class. The first one, B, have several classes (0 to 2499, 2500 to 9999, 10000 to 29999, and over 30000), the second one, C have only two classes: under and over 15000.

 

I have used this code:

LOAD

POPULATION,


If (POPULATION < 2500,'02500',
If(POPULATION > 2459,if(POPULATION < 10000, '250010000',
if(POPULATION > 9999,if(POPULATION < 30000, '1000030000',
if(POPULATION > 29999, '30000')))))) as B,


if(POPULATION > 15000, '15000', '015000') as C

 

It works perfectly fine for B column, all my population stamps are well written on the field, but it doesn't work on col C (which seems to be the same formula, even easier than col B).

On col C, i only have the '015000' stamp, on every line. I tried different ways, but it allways end up with results like this:

POPULATION            /      B      /      C

631894 / 30000 / 015000    <- B is OK, C is supposed to be '15000' and not '015000' because POPULATION> 15000

145        / 02500 / 015000    

Some clues about this?

Thank you

Labels (3)
1 Solution

Accepted Solutions
QFabian
Specialist II
Specialist II

1 Reply
QFabian
Specialist II
Specialist II