Forum Discussion

powerbityro's avatar
powerbityro
Icon for Helper II rankHelper II
6 years ago

group by two columns from two tables

hi all,

 

how can i use GROUP BY when i want to group by two columns from two different tables?

 

For example i need one measure to group by colum1 and column2:

GROUP(Table1, Table1[Column1])

GROUP(Table2, Table2[Column2])

 

finally i want to count over these new table.

 

many thanks

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI powerbityro ,

    Unfortunately, groupby function does not allow you to use multiple table columns, you can only use one table which defined in the function table parameter.

    You can consider using SUMMARIZECOLUMNS function, it allows you to group records based on different table fields.

    SUMMARIZECOLUMNS

    Regards,

    Xiaoxin Sheng

    • powerbityro's avatar
      powerbityro
      Icon for Helper II rankHelper II

      hi thanks for the advice.

       

      how can i use SUMMARIZECOLUMNS to count the number of records grouped by two columns?

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI powerbityro ,

        Do your tables contain relationship mapping? If not, you can't get the correct calculation result based on multiple table column groups. 

        If you confused about coding formula, please share some sample data for test.

        Regards,

        Xiaoxin Sheng