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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Normalize data contents of two tables into one new table

Hi,

 

Any advice on how I can Normalize these two tables into one? I am having a tough time getting this data manipulated in Power Bi Query.

 

I have these two data source tables. I want to Normalize them into one table. What would the best way to do this?

Would it be best to use a Calculated Table? Filter?

 

Ideally, I want one table that returns the most recent Product Name, Summed Remaining Inventory, Most Recent Cost Per Unit, Most Recent Retail Price.

 

Table 1 : Product Data

 

Product data Example #1

 

Product 1.PNG

 

 

 

Table 2 : Inventory Data

 

Inv 1.PNG

 

 

I am running into the Product having same but different name and Id's too… For some of the Products. Not sure the best way to filter all this.

 

Table 1 : Product Data

Product data Example #2

 Product 2.PNG

 

Table 2 : Inventory Data

 

Inv 2.PNG

 

Would I sort by Latest product name and id first? Then, grab the Current Inventory, Cost of Product, and Retail Price in a Filter or Calculated table?

 

I added in two Calculated Columns for MAXDATE and Latest into the Products Data Table. I just can't combine the two tables effectively that returns the correct most recent updated data.

 

 

Maxlatest.PNG

  

 

Normally, in Excel I would use Pivot tables and Vlookup, but I am excited about the automated capabilities of Power Bi!

I am new to Power Bi and at DAX too, but need some advice on the best way to create my data model with this data source.

 

Thanks for all the help!

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi ModernAchilles,

 

Merge the two tables based on column created. Suppose the merged table named 'Merge', then create four measures like pattern below:

 

most recent Product Name =
CALCULATE (
    MAX ( Merge[Product Name] ),
    FILTER ( Merge, Merge[created] = MIN ( Merge[created] ) )
)

most recent Summed Remaining Inventory =
CALCULATE (
MAX ( Merge[Summed Remaining Inventory] ),
FILTER ( Merge, Merge[created] = MIN ( Merge[created] ) )
)

most recent Cost Per Unit =
CALCULATE (
MAX ( Merge[Cost Per Unit] ),
FILTER ( Merge, Merge[created] = MIN ( Merge[created] ) )
)

most recent Retail Price =
CALCULATE (
MAX ( Merge[Retail Price] ),
FILTER ( Merge, Merge[created] = MIN ( Merge[created] ) )
)

Regards,

Jimmy Tao

 

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

Hi ModernAchilles,

 

Merge the two tables based on column created. Suppose the merged table named 'Merge', then create four measures like pattern below:

 

most recent Product Name =
CALCULATE (
    MAX ( Merge[Product Name] ),
    FILTER ( Merge, Merge[created] = MIN ( Merge[created] ) )
)

most recent Summed Remaining Inventory =
CALCULATE (
MAX ( Merge[Summed Remaining Inventory] ),
FILTER ( Merge, Merge[created] = MIN ( Merge[created] ) )
)

most recent Cost Per Unit =
CALCULATE (
MAX ( Merge[Cost Per Unit] ),
FILTER ( Merge, Merge[created] = MIN ( Merge[created] ) )
)

most recent Retail Price =
CALCULATE (
MAX ( Merge[Retail Price] ),
FILTER ( Merge, Merge[created] = MIN ( Merge[created] ) )
)

Regards,

Jimmy Tao

 

Hi Jimmy,

 

Thanks for the help! Your advice on merging the tables really helped me solve it.

 

I Used the Product Name and ID with a Left Outer on the inventory table to create the new table. Where I can now pull the right information like you suggested in those formulas.

 

Thanks again!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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