Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Create a dimension table from several tables

Hi
How is it possible to create a dimension table from several tables. All the solutions I have found here only work if each individual table has unique values.  In my case, I want to be able to create a dimension table from 15 tables. For instance, I want to be able to take the "Country column" of each table and create a Dimension table for "Country".  It should be noted that there some some countries that appear on both tables while some don't

  • Anonymous , In DAX

    New Table = Distinct( union(

    Distinct(Table1[country]),

    Distinct(Table2[country]),

    Distinct(Table3[country]) // add comma when add other

    // add others

    ))

     

    Because values in tables are unique qw are force to use distinct inside too

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

    Here  use distinct function to remove duplicates and use union to combine tables.

    You can try value function and summarize function as well.

    Table = 
    SUMMARIZE (
        UNION (
            VALUES ( Table1[Country] ),
            VALUES ( Table2[Country] ),
            VALUES ( Table3[Country] )
            // add other columns//
        ),
        [Country]
    )

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

     

3 Replies

  • Anonymous , In DAX

    New Table = Distinct( union(

    Distinct(Table1[country]),

    Distinct(Table2[country]),

    Distinct(Table3[country]) // add comma when add other

    // add others

    ))

     

    Because values in tables are unique qw are force to use distinct inside too

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    Here  use distinct function to remove duplicates and use union to combine tables.

    You can try value function and summarize function as well.

    Table = 
    SUMMARIZE (
        UNION (
            VALUES ( Table1[Country] ),
            VALUES ( Table2[Country] ),
            VALUES ( Table3[Country] )
            // add other columns//
        ),
        [Country]
    )

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous this works but doesn't filter out the blank rows. Is there a way to go about that without creating another table?