Qlik Community

Ask a Question

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Creator II
Creator II

Why calculated fields shows minus (-) and not a value?

Hi QV users,

i have a problem with calculated fields.

I've imported some txt files and i create a table with some fields and calculated ones.

I don't know why the column "LABEL4" ([LABEL1]-[LABEL2]-[LABEL3]) don't show me any value but only a minus (-).

If  correct, the total of "LABEL4" should be the same of the total of "LABEL1".

I think that the problem is in the expression "LABEL2":

Num(If([FIELD4]=1,
Num(Left([FIELD2],5)
& ',' &
Num(Right([FIELD2],2)
,0))))

and "LABEL3":

Num(If([FIELD4]=1,
Num(Left([FIELD3],2)
& ',' &
Num(Right([FIELD3],2)
,0))))

Please, can someone help me?

Thanks,

Mattia

Labels (4)
1 Solution

Accepted Solutions
Partner
Partner

Hello Mattia,

I believe your if statements have to be reworked a bit.  Without sample data is hard to say but it seems they are returning nulls therefore the operation [LABEL1] - [LABEL2] - [LABEL3] result is null which is represented by a -

My suggestion is to evaluate each LABEL on it's own before calculating LABEL4.

Try this for LABEL2 (and same idea of the LABEL3). I just moved the closing parenthesis....

num(If([FIELD4]=1
                    ,num(Left([FIELD2],5)& ',' &Num(Right([FIELD2],2)))
                    ,0
                 )
          )

View solution in original post

4 Replies
Partner
Partner

Hello Mattia,

I believe your if statements have to be reworked a bit.  Without sample data is hard to say but it seems they are returning nulls therefore the operation [LABEL1] - [LABEL2] - [LABEL3] result is null which is represented by a -

My suggestion is to evaluate each LABEL on it's own before calculating LABEL4.

Try this for LABEL2 (and same idea of the LABEL3). I just moved the closing parenthesis....

num(If([FIELD4]=1
                    ,num(Left([FIELD2],5)& ',' &Num(Right([FIELD2],2)))
                    ,0
                 )
          )

View solution in original post

Creator II
Creator II

I believe that means that there is more than one possible value for that expression. If you use a listbox and select only one value for Field 2 or Field 3, it should show some value. You may need to use set analysis or other logic to get it to display what you want.

Creator II
Creator II

Thanks guys for the message.

I'll try and i'll let you know!

Mattia

Creator II
Creator II

Thank you so much, Alberto!

Now, it works!!!

Have a nice day,

Mattia