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
Anonymous
Not applicable

Merge the tables

Good morning all !

 

I would like your help on a problem that I have been encountering for weeks!

I will explain my situation to you very quickly:

 

In my Power Bi report, I have two tables:

 

  1. A "DAD Factory" table
  2. A"Master table" table

 

In my "DAD factory" table I have 5 columns:

  • "Material Code"
  • "Extraction date" 
  • "ADI number" 
  • "Cause ADI number"
  • "Stock quantity"

It should be noted that there are several duplicates in this table.
For example a material code can have several ADI Number and several extraction date:

Here's a quick example (in red you can see the duplicates)

 

 

 

Extraction date (A column with duplicate rows)Material Code (A column with duplicate rows)ADI number (A column with unique data)Cause ADI number (A column with duplicate rows)Stock quantity
01/01/2020 (always the date of the first of the month)3612620115/12/25no more need25
01/02/2020361262253511/12/27human problem30
01/03/2020361262234534414/12/29shopping problem1500
01/01/20203612620118/12/86human problem36
01/04/2020362519/30/56human problem59

Dad Factory.png


in my Master table I have 4 columns:

  • "Extaction Date"
  • "Material code" 
  • "Forcast"
  • "ABC" Code

I also wish to specify that in this table I also have several duplicates (in red you can see the duplicates).

here is a quick example:

 

Extraction date (A column with duplicate rows)Material Code (A column with duplicate rows)forecastABC
01/01/2020 (always the date of the first of the month)36126201200A(In January we have the code which was categorized in )
01/02/20203612622535300B
01/03/20203612622345344400C
01/03/202036126201740B (In March we have the code which was categorized now in)

 

Dad Factory.png

 

 

I would like to have in my table "master TABLE" for each article code my ADI number and the cause ADI number which is in the table "DAD_Factory", I also want that we take into account the date of extraction of the two tables to try to have a historical follow-up.

I tried the solution to merge my two tables, but this is not possible because it doubles my rows in the "Master_table" and suddenly my forcaste too.

Can a person help me find a solution!

 

Can someone help me?

3 ACCEPTED SOLUTIONS
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

didn't you post this or at least a very similar question already? What changed now?

 

BR

 

Jimmy

View solution in original post

Hello

 

what about creating a material table (extracting all material code from your both table and get distinct value) and a date table, connect all three tables and then use a matrix like this

Jimmy801_3-1613734237223.png

 

 

Jimmy801_2-1613734181547.png

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

 

 

 

View solution in original post

Hello @Anonymous 

 

for the date-table is better to create i manually, and not extracting others dates. So just use function like List.Dates with 3 parameters and create a list of dates and then transform it to a table. What you can however do ist to calculate the start date form your earliest date present in the tables. Hope I was clear enough

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hello @Jimmy801 ,

 

Your solution was great, but I realized that when I group my ADI codes, I lose the possibility of transmitting the other columns of my DAD FACTORY table.

Maybe I misspoke the first time.

 

but I will try to do it again now :

 

What I really want to do is that when I filter on a date of the extraction, I have the possibility to see for an item code the different ADI numbers that it had and the different causes of ADIs at the period that j've filtered.

Example:

when I filter for 01/01/2021, I know that at that time I had the article code 567 and that it had the ADI number "13/25/456" and that the cause of this ADI is the "Human Cause".

hope you understood my request.

Thanks jimmy

Hello @Anonymous 

 

you could then add a key-column to both of your tables where your are combining date and material number. In Power BI create a realationship between them and visual your data. Will this work out for you?

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

@Jimmy801 

I just tried your method and it doubles the lines.
don't you know another solution?

 

regards,

Hello

 

what about creating a material table (extracting all material code from your both table and get distinct value) and a date table, connect all three tables and then use a matrix like this

Jimmy801_3-1613734237223.png

 

 

Jimmy801_2-1613734181547.png

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

 

 

 

Anonymous
Not applicable

I believe this works.

Do you know how I have to extract the item codes in my Master Table?

Hello @Anonymous 

 

you mean material codes?

I used this code to get the material-table. I combined both columns of material code, get distinct values and then transformed into a table

let
    Source = List.Distinct(List.Combine({DAD[Material Code], Master[Material Code]})),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Material Code"}})
in
    #"Renamed Columns"

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

it works, thanks for your help.

One last question for the end (I promise it's the last).

Do you know how I should do to extract the "Date of extraction" column and the "MaterialCode" column from my "Master_Table" table.

Hello @Anonymous 

 

for the date-table is better to create i manually, and not extracting others dates. So just use function like List.Dates with 3 parameters and create a list of dates and then transform it to a table. What you can however do ist to calculate the start date form your earliest date present in the tables. Hope I was clear enough

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

didn't you post this or at least a very similar question already? What changed now?

 

BR

 

Jimmy

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!

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.

Top Solution Authors