I get "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value." when i try to summurize "Measure" based on column and expression
I have written the code below for a measure that counts no of rows on the sales table first.
After this to be able to create a summary over Employee to be able later to create a measure based on the sum for the Employee in the same table,
But i always get "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."
I feel that i have tried everything but i just dont know anymore what to do.
Personal sales =
SUMMARIZE( 'Employees'; 'employees'[Name] ;
"SalesPerEmployee"; CALCULATE( [Number of sales]))
Individual measure for no of sales total.
Number of sales = COUNT('Sales'[No])
I want to be able to sum the sales over employee in the same table as i show the individual sales for employees on product.
The reason you are getting an error: SUMMARIZE function returns a table, with multiple employee records.
To fix it, you need to aggregate the numbers:
Personal sales =
SUMX(
VALUES('employees'[Name]),
[Number of sales])
You can use SUMMARIZE instead of VALUES, but usually VALUES function is preferred when you need only one column, and SUMMARIZE is used when you need to group by multiple columns.
Additional note: I'd recommend to change the second measure as follows:
Number of sales = COUNTROWS('Sales')