# New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
Not applicable

## Calculate StockInHand

Hi,

Below table is from excel.

 date StockIN StockOUT StockINH LogicExplanation 01/01/15 100 15 85 100 - 15 = 85 01/02/15 10 45 50 85 + 10 - 45 = 50 01/03/15 1 11 40 50 + 1 - 11 = 40 01/04/15 25 35 30 40 + 25 - 35 = 30 01/05/15 20 10 40 30 + 20 - 10 = 40

How to get the values in "StockINH" using qlikview.

I'm using personal edition, please tell me the procedure to achieve.

Regards,

Pavan.

Tags (4)
1 Solution

Accepted Solutions
MVP

## Re: Calculate StockInHand

That's not supposed to be a field name, it's a expression name, if you name your expression "StockINH", it will work. If you named it different you need to set your expression name:

Expression: Alt(Above(TOTAL [ExpressionName]), 0) +StockIN-StockOUT

11 Replies
MVP

## Re: Calculate StockInHand

Hi Pavan, in StockINH expression you can use:

Alt(Above(TOTAL [StockINH]), 0) + StockIN - StockOUT

Honored Contributor III

## Re: Calculate StockInHand

hi

try this

sum(StockIN)-sum(StockOUT)

Not applicable

## Re: Calculate StockInHand

Hi Ruben,

Out of 5 columns, only first 3(date, StockIN, StockOUT) are in excel, last 2, I have created for your reference.

I need to achieve StockINH, for that last column is the logic.

Regards,

Pavan.

Honored Contributor III

## Re: Calculate StockInHand

create a straight table and date as dimension use above code in script

MVP

## Re: Calculate StockInHand

Yes, I know that, please check attachment.

MVP

## Re: Calculate StockInHand

OK, you have personal edition... what I did:

Script:

LOAD Date(date) as date, StockIN, StockOUT;

date,StockIN,StockOUT

01/01/15,100,15

01/02/15,10,45

01/03/15,1,11

01/04/15,25,35

01/05/15,20,10

];

Graph:

Dimensions: date,StockIN,StockOUT

Expression StockINH: Alt(Above(TOTAL [StockINH]), 0) +StockIN-StockOUT

Not applicable

## Re: Calculate StockInHand

Hi Ruben,

I don't have stockINH column in excel, it is showing error.

Regards,

Pavan.

MVP

## Re: Calculate StockInHand

That's not supposed to be a field name, it's a expression name, if you name your expression "StockINH", it will work. If you named it different you need to set your expression name:

Expression: Alt(Above(TOTAL [ExpressionName]), 0) +StockIN-StockOUT

Not applicable

## Re: Calculate StockInHand

Hi Ruben,

Thanks a ton for your shift help.

You really deserve it.

Thank you so much.

Regards,

Pavan.