cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ninsights
Helper II
Helper II

Formula Help Needed - Trying to Expand a 2-level Bill of Materials

FormulaQuestion.jpg

I'm using Product #30014 for this example. The data set actually has many products in it.

 

This table says that product 30014 is created using items (parts) 3316, 3317, 3510, 50121, 50123 and SUB-assembly 34941. The first three columns are formed by matching a product list table to a Bill of Materials table.

To expand the SUB-assembly into its items/parts, I joined a second copy of the Bill of Materials table into the model. The last two columns in the example above tell us that SUB-assembly 34941 is made up of parts 2107A and 3494.

 

I would like to add a column (called MyNewColumn) to this visualization which does the following:

If [Item ID - Level 2] = blank

   then MyNewColumn = [Item ID - Level 1]

Else

  MyNewColumn = [Item ID - Level 2]

 

Any suggestions on how to make this work is greatly appreciated.

 

The result of this formula should be:

 

Assembly ID   MyNewColumn

30014             3316

30014             3317

30014             2107A

30014             3494

30014             3510

30014             50121

30014             50123

5 REPLIES 5
ninsights
Helper II
Helper II

Note that Item ID - Level 1 comes from table 'BOM1" and Item ID - Level 2 comes from table "BOM2."

Also, what I showed below is a data viz, not columns in a data table.

 

Hi @ninsights ,

 

What do the tables 'BOM1" and " BOM2." look like? Could you please share the data struct of them to me?

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @ninsights ,

 

Kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive for Business and share the link here.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
v-frfei-msft
Community Support
Community Support

Hi @ninsights ,

 

Please create the calculated column as below.

MyNewColumn =
IF (
    'Table'[Type] = "Sub",
    'Table'[Item ID -Level 2],
    "" & 'Table'[Item ID - level 1]
)

new.PNG

Pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Mariusz
Community Champion
Community Champion

Hi @ninsights 

 

You  can use Unpivot column in Query Editor ( Power Query ) if you would like to see the solution applied to the data sample then please provide the data sample 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.