Przemyslaw Remin
Przemyslaw Remin

Reputation: 6960

SUMMARIZECOLUMNS handling multiple columns with the same name

For debugging purpose I want to create a DAX table using SUMMERIZECOLUMNS fuction which selects the same column names of two different tables.

Tab = SUMMERIZECOLUMNS ( Sales[Product_ID], Product[Product_ID] )

It raises an error:

The Column with the name of 'Product_ID' already exists in the 'Tab' Table

Replacing Product[Product_ID] with: SELECTCOLUMNS( Product, Product[Product_ID] ) does not solve the problem as it produces error:

A single value for column 'Product[Product_ID]' in table 'Product' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

Upvotes: 0

Views: 5461

Answers (1)

Przemyslaw Remin
Przemyslaw Remin

Reputation: 6960

We can handle renaming the same column names of different tables with SUMMARIZE. With SELECTCOLUMNS we can refer to both table and column.

SELECTCOLUMNS(
    SUMMARIZE(
        Sales,
        Sales[Product_ID],
        Product[Product_ID]
    ),
    "Col1", Sales[Product_ID],
    "Col2", Product[Product_ID]
)

Upvotes: 1

Related Questions