Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

InputSum syntax, Set Expression on distribution mode


Hi,

I would like to know if somebody had experiance with seting expression on distribution in InputSum?

In example I'll try to explain.

1 Step

Picture 1.JPG

I have three line with values and totalsum. The Lock Filed means that when I want to lock value I 'll put value 1 and I want this Value to be fixed for further calculations.

2 Step

Picture 2.JPG

I've chose the field I want to be locked.

3 step

Picture 3.JPG

Than I've changed the total amount from 600 to 900. The QV had made calculation. But, I am not satisfied with result.

Solution is to change formula from InputSum(Amount,'*') to InputSum({<Lock={0}>} Amount, '*') .

4 Step

Picture 4.JPG

Now, I get the right selection to distribute, but I want to see total sum of 900.

I saw in Help and reference manual that Syntax of InputSum is littele bit different from what you get as flying help in expression editor.

Picture 6.JPG

and

Picture 7.JPG

Look at the syntax, SetExpression is on two different places.

The Actual gives selection over records with Lock field = 0, but now I want different approuch.

I want to see total sum of amount, but distributon only at selected records that have Lock field with 0.

Is it possible?

Thx in advance.

Tom

5 Replies
sunny_talwar

Use the concept of dimensionality here:

If(Dimensionality() = 0, InputSum(Amount,'*'), InputSum({<Lock={0}>} Amount, '*'))

sunny_talwar

Using this expression:

=If(Dimensionality() = 0, InputSum(Amount,'*')*1.5, InputSum({<Lock={0}>} Amount, '*')*1.5)

I got the following output:

Capture.PNG

Attaching a sample app for reference.

Best,

Sunny

Not applicable
Author

Thx for short response.

But, It is hard coded, It has to be free to Input any value, inputfield functionallity must be there at all time.

Under, with all item should be visible sum of amount and if you change total amount, it should be spread only to items with 0, not with 1. In further steps you can change Lock to 0 and do it again.

But I appreciate the way to solve problem.

Thx

Tom

sunny_talwar

I am not sure I understand. It is not hard coded, have you tried changing the Lock Field values??? Only thing hard-coded here is 1.5 (I used this because I did not know how you were multiplying everything with 1.5), but other than that it is all dynamic. For example, try doing 1 for Item 1 in the Lock Field and see what happens.

Best,

Sunny

Not applicable
Author

Hi Sunny,

I am trying to attache example file, but it seems that I dont know.

my private email is tomislav.lepcin@gmail.com.

If you still are willing to help me, pls send me your PM.

thx

Tom