5 Replies Latest reply: Sep 26, 2011 6:47 AM by Chetan Surana

# How to generate report as follows based on provided input

above it he Input file And I want to display as report as below

 Symbol Qty Avg Total Amt Realized Profit A 366 109.27 39992.8 -6462.11 B 10 1225 12250 4660.25

Realized profit is what I am intereseted. Once person sells in all the preious buy(avg of previous) subtraction of current sell gives realsied profit.

But new buy should not change the Realized profit until there is subsequent sell.

Please an body would help me to do as above.

• ###### How to generate report as follows based on provided input

hi,

Can you describe your problem with expression used and with a example.

HTH

• ###### How to generate report as follows based on provided input

I am intereseted in the finding the Realised profit. That depends upon the Sell of the product i.e. till it reads in  sell. all the avg buy(prior to current sell not after the sell row(i.e new buy not added unitl there is sell and avg buy has changed due to this) minus the current sell. That is where i am facing the problem.
For ex. product A till  4th row is as follows( mentally calculation as follows but how to do in Qlikview?)

Qty                  Total amount  Profit  Avg

 456 55956 0 122.71

When the 5 the row is read in

it would  like that

Qty                  Total amount  Profit  Avg

 256 37876 -6462 122.71

and when the 6th row is read it should be as displayed in the output.

 Symbol Qty Avg Total Amt Realized Profit A 366 109.27 39992.8 -6462.11

I Have presented just one Product. Similary for the other product.

Hope it clarifies what I am looking for.

• ###### How to generate report as follows based on provided input

Hi There,

There are a few ways how you can solve this.

if(Action = 'Buy',  Qty, (Qty)*-1)   as CallQty,

This turns your quantity with action Sell in to a negative number.

Let me know if this works for you.

Good luck,

Dennis.

• ###### How to generate report as follows based on provided input

But it wont find Realized profit as the that would be cummalitive of all the buy minus the sell. But I am looking for realised profit which depends upon current sell minus all previous buy which will give me my profit. And that subseqent buy is add that does not alter my realised profit(which is already booked) until i sell the remaining.
Above i presented the exact  calculation which is to be done but how to do in Qlikview not sure about it.