I have a table with duplicate names and payments, I want to add a third column with salary (all payments = salary) with grouping by people. I need to add a column to an existing table in DAX (pbi). Can you help with the code?
Name Payments Salary
Peter 5000 9300
Ivan 2500 7600
John 3100 6500
Peter 4300 9300
William 4250 6850
Michael 1900 6500
John 3400 6500
Michael 4600 6500
Mike 6700 6700
William 2600 6850
Ivan 5100 7600
But now I only have this formula, which does not work and gives the error :
The expression references more than one column. Multiple columns cannot be converted to a scalar value.
Salary = SUMMARIZE('Table', 'Table'[name], "Salary", SUM('Table'[refs]))
The problem with the SUMMARIZE function in your formula is that it actually returns a table and not a single scalar value, which is what you're expecting in a calculated column.
Instead, you should use the SUMX and FILTER functions :
Salary =
SUMX(
FILTER(
'Table',
'Table'[Name] = EARLIER('Table'[Name])
),
'Table'[Payments]
)

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With