Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiple expressions

Hello,

I am new to QlikView and I would appreciate some help considering expressions. I have three fields and every field had 2 expressions for its value. Is it possible to assign multiple expressions to one field?

For example: X=Y*Z and X=W-Y

I stored two of those formulas into variables and I have values $(X1) and $(X2). Is there a way I can assign both formulas to one field, so the field value is calculated based on both formulas?

I would really appreciate some help

Thank You!

12 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

I am not sure what you are trying to achieve. How would the two expressions work (ie which value would you use)?

A field value is one value, so how can you calculate it using two different expressions?

Are you thinking of doing this in the load script or the front end?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sagarkharpude
Creator III
Creator III

Try getcurrentselections() or getcurrentfield()

tresesco
MVP
MVP

Just posted a sample here: Re: Using field value in table expression. Hope that helps.

Not applicable
Author

I am trying to calcuate a field value so it is correct by watching any of two formulas. For example Y=100, Z=0,1 and W =110

X=Y*Z     X=100*0,1=10

X=W-Y     X=110-100=10

Is there a way I can make such double condition? I went through functions, but I´m not sure if it´s even possible to make such expression

stigchel
Partner - Master
Partner - Master

It is not quite clear what you want, but if you want to display two outcomes for one field value you can e.g. use

='Count: $(X1) Sum: $(X2)'

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

LOAD

*,

Y*Z AS X1,

W-YAS X2

FROM DataSource;

Now simply use Sum(X1) or Sum(X2).

If not, come up with some sample data and your expected output.

Regards,

Jagan.

Not applicable
Author

Can you post an example?

Not applicable
Author

So my problem is the following. I have 4 fields. For example A, B, C, D. A is fixed value and B,C,D can be changed. When I change B... C and D should be updated. When I change C... B and D should be updated. And when I change D... B and C should be updated. Some sample data:

 

           A            B            C            D
100100.1110
100200.2120
100300.3130

B=A*C and B=D-A

C=B/A and C=((D/A)-1)

D=A+B and D=(A*C)+A

Every field should satisfy both conditions. I stored the formulas in variables and tried doing it with triggers, but for some reasons, triggers don´t work.

jagan
Luminary Alumni
Luminary Alumni

Hi,

How you will update B, C and D in front end?

Regards,

Jagan.