Table Function Example, ADDCOLUMNS, Expression refers to multiple columns Error

Mastering Dax Calculations → Advanced Table Functions → ADDCOLUMNS

Table Functions Examples =
// we can put virual tables in where it says filter
// CALCULATE([Total Sales], here
ADDCOLUMNS(
VALUES(Products[Product Name]),
“Profit Margins”, [Profit Margin] )

Error:
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

I’m assuming that I am missing something within modeling.

Mastering+DAX+Calculations±+Base+File.pbix (393.0 KB)

Hi @bricek6.

You’ve commented-out the CALCULATE line in the DAX query and are only returning the FILTER portion of the CALCULATE statements. Measures can only return a single scalar value, not a table, hence the error. Here’s your code with the first line uncommented:


Table Functions Examples = 
// we can put virtual tables in where it says filter
CALCULATE( [Total Sales], 
    ADDCOLUMNS(
        VALUES( Products[Product Name] ),
    "Profit Margins", [Profit Margins] )
)

And this gives the following:

Hope this helps.
Greg
eDNA Forum - Mastering DAX Calculations.pbix (397.2 KB)

1 Like

I wanted to see the virtual table as a look up table for reference sake. I think I selected the wrong calculation like new column or new measure instead of new table. It works now, thank you!

image