# Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

Contributor II

## Logic

Dear team,

I stuck a requirement. Kindly help me for solving this type of problem

Id         startdate            saleamount       end date              collamount   inventoryamonut

1          01/03/2016       50000                 03/03/2016        10000             saleamount-collamount

1          01/03/2016        50000                05/03/2016        20000             leftamont-collamount

1          01/03/2016        50000                07/03/2016        30000               left amount-collamount

Requirements is

In above table we have to calculate inventoryamonut. Which is saleamount-collamount

Left amount means saleamount - collamount.......

Then third left amount above left amount........

Kindly help me for solving this

5 Replies
Contributor II

## Re: Logic

Still be waiting... Kindly help me

Contributor II

## Re: Logic

first try to ask your question in new to Qlikview ‌you'll have more chance to get an answer.

Secend, your request is not clear, try to explain with an exemple or the result you want to see

Regards

Marwen

Contributor II

## Re: Logic

Dear  sir,

I want to find out inventoryamonut...........

Which is  saleamount-collamount like 50000-10000=40000(this is left then next will be less from this)

Then 40000-20000=20000

Then 20000-30000=-10000

Contributor

## Re: Logic

ID   Startdate    SaleAmount    EndDate      Collamount         InventoryAmount             Inventory Amount2

1    01/03/2016       50000       03/03/2016        10000          50000-10000= 40000         40000-20000=20000

1    01/03/2016       50000       05/03/2016        20000          50000-20000 =30000           30000-30000= 0

1    01/03/2016      50000         07/03/2016       30000          50000-30000 =20000              ''

Is this what you are trying to get. Please explain with the sample data.

Contributor II

## Re: Logic

Try This :

if(RowNo() = 1 ,SaleAmount-Collamount,  above((SaleAmount-Collamount),1)- Collamount)

EndDate Collamount SaleAmount Inventory Amount Inventory Amount 2
03/03/201610000500004000040000
05/03/201620000500003000020000
07/03/20163000050000200000

Regards

Marwen