Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Highlighted
Not applicable

How to calculate Stock with Weighted average ?

How to calculate stock with weighted average by using stock ledger?

7 Replies
MVP & Luminary
MVP & Luminary

Re: How to calculate Stock with Weighted average ?

I think this will be helpful: Average – Which average?

- Marcus

balrajahlawat
Esteemed Contributor

Re: How to calculate Stock with Weighted average ?

could you share some sample data?

else go thru:

Help on weighted average

Weighted average

miguelbraga
Valued Contributor III

Re: How to calculate Stock with Weighted average ?

Hey there,

Do you have a qvw in which you need that average so that we can provide a solution for your problem?

Thanks,

MB

Not applicable

Re: How to calculate Stock with Weighted average ?

In my stock i have same TWO quanties  which i purchased at different rates follows:

srno   Item   qty   product_rate    value

1.         A      10         1                 10

2.         A       6          1.5               9

Now in my stock have 5qty from my 1st purchase (with purchase rate as rs.1)

and 2nd purchase  i have 6qty .

now as per me weighted avg: is =

   total qty=5+6=11 and value=5+9=14

and product rate changes  to rs.1.27

balrajahlawat
Esteemed Contributor

Re: How to calculate Stock with Weighted average ?

For weighted avg, you can try:

sum(Value)/sum(Qty)

miguelbraga
Valued Contributor III

Re: How to calculate Stock with Weighted average ?

Or something like this:

= Sum(Value) / Count(Value)

MVP & Luminary
MVP & Luminary

Re: How to calculate Stock with Weighted average ?

Within charts you could use something like this:

rangeavg(above(sum(value), 0, rowno(total)))

and within the script you could use peek() and previous() to access previous records: Peek() or Previous() ?

- Marcus