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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Simple Equation in LOAD

I am trying to make an equation within QV in the load statement. We are attempting to figure out our margin by using a 50/50 split between our sales reps. The equation is fairly simple but I am fairly new at QV.

IF(salesrep_id = 3208, 3207 THEN [MARGIN/2])

So in words. If the salesrep_id (field name in DB) is equal to 3208 or any of our sales rep IDs then divide the margin (calculated field name) in half.

Thanks for any help.

1 Solution

Accepted Solutions
Not applicable
Author

Try this:

IF(salesrep_id = 3208 OR salesrep_id = 3208, MARGIN/2,0)

nor

IF(salesrep_id = 3208, MARGIN/2, IF (salesrep_id = 3208, MARGIN/2,0),0)

Good luck!!!

View solution in original post

4 Replies
Not applicable
Author

Try this:

IF(salesrep_id = 3208 OR salesrep_id = 3208, MARGIN/2,0)

nor

IF(salesrep_id = 3208, MARGIN/2, IF (salesrep_id = 3208, MARGIN/2,0),0)

Good luck!!!

Not applicable
Author

My issue now is the field name Margin and field name salesrep_id are stored in two separate tables. Combining the two tables leads to an in efficient application.

So thus I could use a variable?

Variable name: split

Value: IF(salesrep_id = 3208 OR salesrep_id = 3219, MARGIN/2,0)

Then if I make a text box with a condition: =sum(spilt) it should give me a value. Currently it gives me a value of zero.

Any other ideas on how to do this if I do not want to this in the load.

Thanks.

Not applicable
Author

So if you place this just in the text box it works.

=sum(IF(salesrep_id = 3208 OR salesrep_id = 3219, Margin/2,0))

What a neat application...

hector
Specialist
Specialist

this way works too

=sum(IF(match(salesrep_id,3208,3219), Margin/2,0))

rgds