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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ninsights
Helper III
Helper III

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 III
Helper III

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.