Forum Discussion

dennis1994's avatar
dennis1994
Frequent Visitor
8 years ago
Solved

Combine two tables

Hello,

I would like to combine table 1 and table 2 from my photo, so that i end up like table 3. i dont quit get it. Can someone help me please?

 

Regards

Dennis

  • hi, dennis1994 acanepa

     

    1. Import the data from TABLE1
    2. Import the data from TABLE2
    3. Edit the query in TABLE2 and remove the duplicates
    4. Combine tables TABLE1 and TABLE2
    5. Group the values (as pictured)

     

     

     

     


    Please try and test using it. And please mark the right answer as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.
     
    Best Regards,
    Rfranca

5 Replies

  • Hello dennis1994,

     

    You could use Crossjoin and filter to solve you issue.

     

    I have created a sample workbook for replicating your data.

     

    Table 3 is the example of what you want to achieve.

     

     

    Table 1

     

     

    Table 2

     

     

    Table 3

     

     Code:

     

    Table 3 = filter(
    CROSSJOIN(Table1,Table2),[id]=[id2] && [Date] =[Date2])

     

    I get the information from the following link:

    https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

     

    Sample Workbook

    https://ufile.io/rt1ae

     

    Regards,

    • dennis1994's avatar
      dennis1994
      Frequent Visitor

      Hello acanepa,

       Thanks for the fast reply. Where exactly do i need to input the code? When i try to create a new table i get following error:

       

      • acanepa's avatar
        acanepa
        Resolver I

        Hi dennis1994

         

        You need to change the column name "dri_exact_date" in one of the tables, the formula does not allow two columns with the same name.

         

        You could use SELECTCOLUMNS for filtering columns.

         

        Regards,