Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add a column my multiplying 2 diffrent columns .

Hi ,

I have a very easy question.

of adding an extra column based on the values from diffrent table.

Please refer to the QVD & Attachment.

It is adding an extra column called Bonus in the Table after salary. based on the multiplier factor from the other column range.Regards

Debashish.

5 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Debashish,

as much as I don't like using IF statements in charts, this is one of those cases when it's needed:

sum(Salary * (if (Min <= Salary and Dalary <= Max, Multiplier))

cheers!

Not applicable
Author

you're missing a closing parenthesis there..


sum(Salary*(if(Min <= Salary and Salary <= Max, Multiplier)))






Not applicable
Author

Hi Thanks , Oleg ...

You have also Previously Solved .. much of my queries. and gave me how to think in Qlikview way.

I have got the solution. But i have 2 Queries.

1. Why u have added the "Sum" . I can see Sum only gives the Result.

2. What do u suggest me , if not we use IF Statement.

Do you suggest me to do someting in the Load Time to add the Bonus Column (like Resident Table Join) in the Edit Script.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP


Debashish wrote:Do you suggest me to do someting in the Load Time to add the Bonus Column (like Resident Table Join) in the Edit Script.


If you can do the calculation in the load script. then I suggest using INtervalMatch.

-Rob

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Debashish,

if your data set is fairly small, it's OK to use IF statements - you won't affect performance too much. If you can pre-calculate the bonus in the script, without too much trouble, it would be better of course, because you are moving the heavy load from the run-time into the load time.

Regarding sum() - if this is a Straight Table, then we should use aggregation function (like sum) to ensure that our expression works at all summary levels - this way, you can present totals, or change your dimensions, and the expression will still be valid.

cheers,