Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
FredBus
Frequent Visitor

Measure for production Bom table to calculate the requirment sub-items for multipack items

Hi @all,
i can´t solve my problem. Maybe somone can help?
Given Dataset:
Table: stock_v2 with columns: [quantity] [item number OF/UV] Table: Item with columns: No_ Base Unit of Measure Table: Production BOM Line with columns: Line No_ No_ Quantity No_ item Table: Sales Line with columns: Document No_ No_ Outstanding Qty_ (Base) Requested Delivery Date Table: Date with columns: Date Day Month Year IsoKW #

Active relationships: From Production BOM Line [No_item] to Item [No_]: many to one From Sales Line [No_] to Item [No_]: many to one From stock_v2 [item number OF/UV] to Item [No_]: many to one From Sales Line [Requested Delivery Date] to Date [Date]: many to one

Inactive relationships: From Production BOM Line [No_] to Item [No_]: many to one

Multipack items are defined in the Item table as follows: if Base Unit of Measure <> "STK" , then the item is a multipack item. The Production BOM Line contains information about which individual items in column [No_] belong to which multipack item in column [No_item]. The [Quantity] column indicates the number of individual items in the multipack item. An individual item can exist in multiple different multipack items.

This measure calculates the demand for multipacks from the Sales Line table:

 

 

 

Target demand MP =
VAR orderedQuantity =
CALCULATE(
SUM('Sales Line'[Outstanding Qty (Base)]),
LEFT('Sales Line'[Document No_], 2) = "AU",
FILTER('Production BOM Line', 'Production BOM Line'[No_ item] = SELECTEDVALUE('Item'[No_]))
)

VAR _FinishedGoodsStockMP =
CALCULATE(
SUM(stock_v2[quantity]),
FILTER(RELATEDTABLE('Item'), 'Item'[Base Unit of Measure] <> "STK")
)

RETURN
IF(
(_orderedQuantity - _FinishedGoodsStockMP) <= 0,
BLANK(),
_orderedQuantity - _FinishedGoodsStockMP
)

 

 

 


The result of this measure needs to be multiplied by the Quantity column of the sub-items.
Example BOM Line Table

Line No_No_QuantityNo_ itemrequirement quantity No_itemRequirement quantity sub-item for MP
20000650036504894026820
30000650536504894026820
40000650136504894026820
10000640036504894026820

Example Item Table

No_Base Unit of Measure
6500STK
6505STK
6501STK
6400STK
6504MP

Example Sales Line Table

Document No_No_Outstanding Qty_ (Base)Requested Delivery Date
AU-2200965001368601.10.2023 00:00
AU-2200965051071001.10.2023 00:00
AU-2200965011170001.10.2023 00:00
AU-220096400691201.10.2023 00:00
AU-220096504999001.10.2023 00:00
AU-220106500585010.10.2023 00:00
AU-220106505345610.10.2023 00:00
AU-220106501345610.10.2023 00:00
AU-2201064002010.10.2023 00:00

 

Example Stock Table

no_quantity
65001050
65051050
65011050
64001050
65041050

 


The result should looks like below:

Filter: Item (Base Unit of Measure)= STK

 

No_Base Unit of MeasureOrder quantity itemOrder quantity sub-item for MPStockrequirement quantity itemRequirement quantity sub-item for MP
6500STK195362682010501848626820
6505STK141662682010501311626820
6501STK151562682010501410626820
6400STK6932268201050588226820



 

 



10 REPLIES 10
some_bih
Super User
Super User

Hi @FredBus Intermediate table is wanted output? If yes, from which table and columns values should come from? 

Two columns in this table have the same values: Order quantity sub-item for MP and Requirement quantity sub-item for MP, is it by luck or ...





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






@some_bihi'm sorry for the misunderstanding, you can delete the intermediate table. To cover the demand for multipacks, you can obtain the sums of individual items through the following calculation:

FredBus_0-1688037565170.png

The result from "Target demand MP" should then be indicated as an additional column in the table visual. In the original file, the calculation was solved using calculated columns, where all the required quantities were summed up as calculated columns in the Item table. However, I need a dynamic solution for demand calculation.
This is my calculated column in the  item table from original file. "I can't replicate the issue in the example file because it's resulting in a circular failure, and I'm unsure of the cause.

 


My wanted output is this table visual: I need to see in the table visual the individual item quantities required for single-variety items (Column Target deman item) and the individual item quantities required for multipacks.(Column MP)

FredBus_1-1688037897191.png

 

Hi @FredBus I was thinking about your model, as much as I could understand. Following is concerning your circular reference: it could be that some connection is wrong. As I understand, given that your table are tiny, which is good, you should remodel your model using Power query transofrmation if possilbe, and after that make connection, check results. Example, Item table and Stock table are just few column. I aslo understand that there could be "need" to see data on Document level so you have table Sales line or something. I am just saying, build your model step by step, and use as much model as you need, not single one. Hope this help





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Hi @some_bih , thanks for your response.
I need a report that shows the required quantities of an item as individual units and the required quantities as part of a multipack (where a multipack consists of multiple different individual items). I have already solved this demand calculation using calculated columns in my original file, but unfortunately, I cannot share the data as it is highly sensitive. However, the current report no longer meets the requirements of our planning, so I would like to represent each calculation using dynamic measures. For example, to filter the required quantities by calendar weeks.

Hi @FredBus Honestly I do not fully understand your model so I am not sure how to contribute as calculation logic is unknown for me. Concerning week view, the best would be to implement Date / Calendar table, if you do not have it already.

Week number is usually obtained using funcion. Hope this help

https://learn.microsoft.com/en-us/dax/weeknum-function-dax 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






@some_bihokay... i will resolve the circular issue and update the example file with multiple examples.

FredBus
Frequent Visitor

@some_bihi will make an example file. Where can I upload the file?

@tamerj1"I'm sorry for asking, but last time you were able to solve my problem very well... Do you have any ideas?"

 

 

Hi @FredBus if you have office 365, just send shared link





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






some_bih
Super User
Super User

Hi @FredBus share file thx





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.