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
Pillic
Helper II
Helper II

How to start with this project? 3 tables multiple values

Hello Community,

 

i am new to power bi and stuck with this project.

 

So I have 3 tables:

Region (70 rows) - Plant,Region,Divison etc. - Plant is unique 

 

RawMaterials (6500 Rows) - Plant, Material ID, Units, Price - Plant + Material = unique price for a raw material

rawmaterial.jpg

Recipes (over 1.000.000 rows) - Date, Product, Plant, Material, Amount of Material

recipes.jpg

 

Each product consist of 2-8 different raw materials

The goal is to visualize the price of a product (calculated by the sum of all Rawmaterial prices) over a time period by plant. 

 

And now I am stuck.

 

I want to avoid to add a calculated column to the Recipe table, as its performance is already very bad and I think adding calculated column would increase this behavior.

 

Relationships between the tables: as there are multiple Plants in table RawMaterial and Recipes its not finding the expected filter.

 

It would be great if some one could have a look at this scenario and point me to the right direction.

 

Thanks in Advance

Best Regards

Pillic

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

Difficult to say exactly but it seems like you need to create a composite key between RawMaterials and Recipes. So in PowerQuery, add a column to both like:

 

[MaterialID][Plant]

 

To create a unique key for each material by plant.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

mahoneypat
Employee
Employee

If I understand your scenario, I would do the following:

1. Add a column that merges Plant and Material in both your Raw Material and Recipes tables

2. Make a relationship between your two new columns (1:Many)

3. Use a measure like this - TotalCost = sumx(RawMaterials, RawMaterials[Preis]*Calculate(Sum(Recipes[Wert])))

 

I also assume you have a Date table that is filtering your Recipes table too.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

6 REPLIES 6
mahoneypat
Employee
Employee

If I understand your scenario, I would do the following:

1. Add a column that merges Plant and Material in your commodity and recipe tables

2. Make a relationship between your two new columns (1:Many)

3. Use a measure like this - TotalCost - sumx(RawMaterials, RawMaterials[Preis]*Calculate(Sum(Recipes[Wert])))

I also assume that you have a date table that also filters the Recipes table.

If this works for you, please mark it as the solution. Congratulations are also appreciated. Please let me know if you don't.

Best regards

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Greg_Deckler
Super User
Super User

Hard to say exactly, but it looks like you need to create a composite key between RawMaterials and Recipes. Therefore, in PowerQuery, add a column to both as:

[MaterialID] [Plant]

Create a unique key for each material per plant.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

Hard to say exactly, but it looks like you need to create a composite key between RawMaterials and Recipes. Therefore, in PowerQuery, add a column to both as:

[MaterialID] [Plant]

Create a unique key for each material per plant.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
mahoneypat
Employee
Employee

If I understand your scenario, I would do the following:

1. Add a column that merges Plant and Material in both your Raw Material and Recipes tables

2. Make a relationship between your two new columns (1:Many)

3. Use a measure like this - TotalCost = sumx(RawMaterials, RawMaterials[Preis]*Calculate(Sum(Recipes[Wert])))

 

I also assume you have a Date table that is filtering your Recipes table too.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks Greg and mahoneypat, that helped me out and solved this topic. Now I am a major step further.

 

I created the merged tables - added the relationship - and also the measure. Great!

 

Thanks a lot

Pillic

 

Greg_Deckler
Super User
Super User

Difficult to say exactly but it seems like you need to create a composite key between RawMaterials and Recipes. So in PowerQuery, add a column to both like:

 

[MaterialID][Plant]

 

To create a unique key for each material by plant.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.