Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to insert it in script

I have to sreate a field in qv script how to make it

if([Customer Number Act]='789QWA','DIR', null()) as D,

     if([Customer Number]='9977YU','COMM', null())as C,

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

If you need a unique field the starting conditions are wrong because you can't have a field C and D together.

If you want 2 fields just write what you posted, otherwise, if you need only one field:

if([Customer Number Act]='789QWA','DIR',

          if([Customer Number]='9977YU','COMM', null())

)

as C

hope it helps

View solution in original post

9 Replies
alexandros17
Partner - Champion III
Partner - Champion III

If you need a unique field the starting conditions are wrong because you can't have a field C and D together.

If you want 2 fields just write what you posted, otherwise, if you need only one field:

if([Customer Number Act]='789QWA','DIR',

          if([Customer Number]='9977YU','COMM', null())

)

as C

hope it helps

Not applicable
Author

thanks earlier expression worked

i need one more thing that is

if([Customer Number Act]='789QWA','DIR',

          if([Customer Number]='9977YU','COMM',

if([Customer Number Act]='789QWA',+if([Customer Number]='9977YU','total' null())

)

as C

dir+comm = total

how to write this one

thanks earlier expression worked

alexandros17
Partner - Champion III
Partner - Champion III

can you explain the expression

if([Customer Number Act]='789QWA',+if([Customer Number]='9977YU','total' null())

what does + means?

Not applicable
Author

here the value of the total will be the values of  DIR and COMM and for that what expression should i need

and it's name should be total

alexandros17
Partner - Champion III
Partner - Champion III

You need another field because the same conditions should be evaluated in two different ways

add the field

if([Customer Number Act]='789QWA' or [Customer Number]='9977YU','total' null())

)

as D

Not applicable
Author

but i need the three fields in the same

is there any way it should show me

C D Total

i am using pivot table

alexandros17
Partner - Champion III
Partner - Champion III

I'm sorry but there are no ways:

the condition is on

Customer Number Act

so

if it's value is '789QWA' you want 'DIR'

if it's value is '9977YU' you want 'COMM'

if you add a condition on the same fields and on the same values the condition will be yet satisfyed by the previous one

Not applicable
Author

thanks for tha answer is there any way we can do the sum for the DIR and COMM rows and show on to the right

alexandros17
Partner - Champion III
Partner - Champion III

as I told you before in the script

if([Customer Number Act]='789QWA' or [Customer Number]='9977YU','total' null())

)

as D

or in an expression using a similar sysntax