Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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


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)

 

 

 

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?

  • Hello Anonymous 

     

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

     

    BR

     

    Jimmy

  • Jimmy801's avatar
    Jimmy801
    5 years ago

    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

     

     

     

    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's avatar
    Jimmy801
    5 years ago

    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

9 Replies

  • Jimmy801's avatar
    Jimmy801
    Community Champion

    Hello Anonymous 

     

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

     

    BR

     

    Jimmy

  • Anonymous's avatar
    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

    • Jimmy801's avatar
      Jimmy801
      Community Champion

      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's avatar
        Anonymous
        Not applicable

        Jimmy801 

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

         

        regards,