Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results 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
MVP

May be this

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.

9 Replies

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):

 Item Quantity Accumulated Amount Item-A 20 36 Item-B 3 60 Item-C 6 20 Item-D 4 30 Item-E 5

do you have any other direction?

thanks

MVP

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.

MVP

May be this

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

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
MVP

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.

 ItemGroup Item Quantity Output A Item-A 20 20 A Item-B 3 60 A Item-C 6 360 A Item-D 4 1,440 A Item-E 5 7,200 B Item-A 12 12 B Item-B 5 60 B Item-C 17 1,020 B Item-D 16 16,320 B Item-E 8 1,30,560

Community Browser