Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Product Allocation

Hi everyone !!

This is my problem:

I need to allocate some products based on a Inventory.

This is my inventory:

 

WarehouseProductColorSizeQuantity
W1P11P10
W2P11G15
W1P22G12
W3P21P11
W4P33G

9

And this is my demand:

 

StoreProductColorSizeDemand
S1P11P4
S2P11P3
S3P11P3
S1P11G7
S2P11G6
S3P11G8

This should be my result:

  

StoreProductColorSizeAllocatedOKRemaining
S1P11P4Yes0
S2P11P3Yes0
S3P11P4No1
S1P11G7Yes0
S2P11G6Yes0
S3P11G2No6

As you can see, I need to allocate line by line, based on Product/Color/Size that I have in my inventory.

In this example, I manage to attend the demand of the product P1/1/P in the stores S1 and S2, however, in the store S3, I only had 2 available items (my total inventory for product P1/1/P was 10 itens).

How can I achieve that ?

Thanks!!

Josué

1 Solution

Accepted Solutions
MVP
MVP

Re: Product Allocation

Maybe like attached for a front end solution?

(a script based could be derived from that if needed)

3 Replies
MVP
MVP

Re: Product Allocation

Maybe like attached for a front end solution?

(a script based could be derived from that if needed)

Re: Product Allocation

May be this in the script:

Table:

LOAD Store,

    Product,

    Color,

    Size,

    Demand

FROM

[https://community.qlik.com/thread/212364]

(html, codepage is 1252, embedded labels, table is @2);

Table1:

LOAD *,

  If(Product = Peek('Product') and Color = Peek('Color') and Size = Peek('Size'), RangeSum(Demand, Peek('CumDemand')), Demand) as CumDemand

Resident Table

Order By Product, Color, Size, Store;

DROP Table Table;

Left Join (Table1)

LOAD Product,

    Color,

    Size,

    Quantity

FROM

[https://community.qlik.com/thread/212364]

(html, codepage is 1252, embedded labels, table is @1);

FinalTable:

LOAD Store,

  Product,

    Color,

    Size,

    If(CumDemand <= Quantity, Demand, RangeSum(Quantity, -Previous(CumDemand))) as Allocated,

  If(CumDemand <= Quantity, 'Yes', 'No') as OK

Resident Table1;

DROP Table Table1;


Capture.PNG

Not applicable

Re: Product Allocation

Hello swuehl !

Thanks, this solution helped me !

Community Browser