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

Get the previous value from a column

Hi All, I have been asked to deploy the following requirement:

A table containing 3 columns:

Item         Quantity      Amount

Item-A          20             12

Item-B          3              10   

Item-C          6               5

Item-D          4               6

Item-E          5               2

. . .

. . .

The result should be a chart with the following output:

Item    Quantity              Accumulated Amount

Item-A      20                        20

Item-B      3                         60

Item-C      6                        360

Item-D      4                       1440

Item-E      5                       7200

. . .

. . .

The expression of column "quantity" is : Sum(Quantity)

The expression of column "accumulated Amount" should be:

The Above value (Sum (Amount))  multiple by the current quantity.

For example, in Item-B, the above value is 20 (Sum(Amount) multiple by the current quantity: 3 and the result of the second line is 60.

The third line: above value is 60 multiply by the current quantity 6, the result is 360, etc, etc...

(btw: the value of the first line should be 2 (just the quantity) since we do not have the "above" amount)

I found difficulties to find the appropriate expression for that column in the chart. can someone give me an idea how to solve this?

many 10x.

Eli.

1 Solution

Accepted Solutions
sunny_talwar

May be this

Capture.PNG

But since I referring to my expression again, this expression is selection dependent. Check it out if this helps you achieve what you are looking to do.

View solution in original post

9 Replies
Anil_Babu_Samineni

Perhaps This

Sum(Amount) * Below(TOTAL Sum(Quantity))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Thanks anil, but this expression gives the following results (different from the expected result):

ItemQuantityAccumulated Amount
Item-A2036
Item-B360
Item-C620
Item-D430
Item-E5

do you have any other direction?

thanks

sunny_talwar

Can you explain how did you get 20 for Item-A on your list. I think you did a great job of explaining things after Item-A, but unless I get item-A right, there won't be Item-B, Item-C... etc

Anonymous
Not applicable
Author

Hi Sunny' Thank you for your response.

You are right , i did a mistake in the first line, the quantity of the first line is 20, see the correct example:

Item    Quantity              Accumulated Amount

Item-A      20                        20

Item-B      3                         60

Item-C      6                        360

Item-D      4                       1440

Item-E      5                       7200

. . .

. . .

Now, the results should looks line this:

Item    Quantity              Accumulated Amount

Item-A      2                         20

Item-B      3                         60

Item-C      6                        360

Item-D      4                       1440

Item-E      5                       7200

. . .

. . .

and why the results of the first line is 20 ?, because this is the first line and in this case we do not have the 'Above' so we take just the quantity.


many many thanks.


sunny_talwar

May be this

Capture.PNG

But since I referring to my expression again, this expression is selection dependent. Check it out if this helps you achieve what you are looking to do.

Anonymous
Not applicable
Author

Yes , this is the answer. thank you

Anil_Babu_Samineni

Sunny, What is the Expr1?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

It is the expression label. Self referencing expression where the expression is referencing itself.

Anonymous
Not applicable
Author

QlikExperts,

 

Want the similar solution at group level with required output as per below sample. Please assist.

ItemGroupItemQuantityOutput
AItem-A20               20
AItem-B3               60
AItem-C6             360
AItem-D4          1,440
AItem-E5          7,200
BItem-A12               12
BItem-B5               60
BItem-C17          1,020
BItem-D16        16,320
BItem-E8      1,30,560