Forum Discussion

Kristofferaabo's avatar
8 years ago
Solved

mastertable based on groupby or summarize

Hi,

 

I want to create a new table (Table A) based on colulms from another table (Table B).

 

In my table A I want only unique/distict values from Column A in Table B to be returned, like a pivot in excel.

 

How can I do that, I have tried with groupby and summarize, but now luck..

 

Thanks
Kristoffer

  • Phil_Seamark's avatar
    Phil_Seamark
    8 years ago

    Hi Kristofferaabo

     

    Both should provide unique values.  I wonder if you have leading, or trailing spaces that need to be cleaned using TRIM 

     

    eg, if I have Table B with the following data

     

    Country

    ----------

    A

    A

    A

    B

    B

     

    The output of the DAX I gave you should be

     

    Country

    ------------

    A

    B

     

    I have attached a PBIX file

     

     

4 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Kristofferaabo

     

    You can create a calculated table using the following syntax

     

    New Table = ALL('Table B'[Column A])

    Or

     

    New Table = SUMMARIZECOLUMNS('Table B'[Column A])
    • Kristofferaabo's avatar
      Kristofferaabo
      Icon for Helper IV rankHelper IV

      Hi Phil_SeamarkI think I have tried this, but it wont return unique values.. For instance I column A was a country column, I only want United States to be returned once.

       

       

      Do I do something wrong?

      • Phil_Seamark's avatar
        Phil_Seamark
        Icon for Microsoft Employee rankMicrosoft Employee

        Hi Kristofferaabo

         

        Both should provide unique values.  I wonder if you have leading, or trailing spaces that need to be cleaned using TRIM 

         

        eg, if I have Table B with the following data

         

        Country

        ----------

        A

        A

        A

        B

        B

         

        The output of the DAX I gave you should be

         

        Country

        ------------

        A

        B

         

        I have attached a PBIX file