Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Bom Calculation

Hi everyone!

I have these two tables:

  table1:

ItemNumberType101_Q101_A102_Q102_ATotal_QTotal_A104_Q104_A201_Q201_A202_Q202_A203_Q203_A
A100P111112823193030120130
A101P1312131326251104020110
A102P23294126012060120
A103P71091216221408015020
B100M1552062530505030
B200M21053074020404030
B300M55247930502020
B400M545510930404050

table2:

 

ItemNumberTypeItemNumberQ
A100PB1001
A100PB2002
A101PB1002
A101PB2001
A101PB3003

the first task which I've done is to calculate the 104_A to 203_A. the second one which is complicated is to calculate the cost of P type through its BOM(table2) . the answer should be like this:

 

ItemNumberTypeItemNumberQTotalA/TotalQCost
A100PB10014.1666674.166667
A100PB20025.71428611.42857
A101PB10024.1666678.333333
A101PB20015.7142865.714286
A101PB30031.285714

3.857143

my QV file is attached here, how to tackle this problem?

1 Solution

Accepted Solutions
sunny_talwar

Script

Table:

CrossTable(Transaction, QA)

LOAD ItemNumber,

    [101_Q],

    [101_A],

    [102_Q],

    [102_A],

    Total_Q,

    Total_A,

    [104_Q],

    [104_A],

    [201_Q],

    [201_A],

    [202_Q],

    [202_A],

    [203_Q],

    [203_A]

FROM [6.xlsx]

(ooxml, embedded labels);


FinalTable:

LOAD *,

SubField(Transaction, '_', 1) as Transaction_First_Part

Resident Table;


DROP Table Table;


Table:

LOAD ItemNumber,

    Type,

    ItemNumber1,

    Q

FROM

[6.xlsx]

(ooxml, embedded labels, table is BOM);


Left Join (Table)

LOAD ItemNumber as ItemNumber1,

Transaction as New_Transaction,

QA as New_QA

Resident FinalTable

Where Match(Transaction, 'Total_Q', 'Total_A');

Capture.PNG

Chart expressions

=Sum({<New_Transaction = {'Total_A'}>}New_QA)/Sum({<New_Transaction = {'Total_Q'}>}New_QA)

=Sum({<New_Transaction = {'Total_A'}>}New_QA)/Sum({<New_Transaction = {'Total_Q'}>}New_QA) * Q


View solution in original post

16 Replies
sunny_talwar

I am not completely sure I understand what you are trying to do? first of all, do you have 2 things you are trying to accomplish or 1 is done and your trying to do the 2nd now?

Anonymous
Not applicable
Author

Hi Dear Sunny Talwar

I am trying to do the 2nd one now? Bom calculation or Cost per P Type

sunny_talwar

How exactly do you perform those calculations? I mean the logic?

Anonymous
Not applicable
Author

You know, Actually the table 2 should be complicated by TotalA/TotalQ and Cost

Anonymous
Not applicable
Author

As you look at the table 2, at first we see product A100 uses B100 and B200 material and B100 and B200 price is calculated by Total B100 A/ Total B100 Q. Then we should multiple this price by B100 and B200 quantity.

 

ItemNumberTypeItemNumberQTotalA/TotalQCost
A100PB10014.1666674.166667
A100PB20025.71428611.42857

As it clear?

sunny_talwar

Is this something you can do in the script?

Anonymous
Not applicable
Author

Yes I really can

Anonymous
Not applicable
Author

Sorry Sunny Talwar

You find the solution?

sunny_talwar

Would you be able to share the Excel file?