SUMX result in power pivot

A dedicated forum to help people when working through the book "Learn to Write DAX"
Dibritti
Posts: 1
Joined: Fri Nov 22, 2019 10:30 am

SUMX result in power pivot

Postby Dibritti » Fri Nov 22, 2019 10:50 am

Hello,

I´m very new in dax, so I please call for your help and patience,

I have an issue to wright the SUMX formula in Power pivot,

I can't get the formula to give me a simple result of multiplying the column X with column Y
This is my formula:

=SUMX(Base;Base[Price]*Base[Quantidade])

the result is wrong and it repeats (same result) in every rows in the table and the data in each row is different
ex: of result:
Column base[price] = 1200
column base[quantidade] = 12
result column = 2228924522,89161

Can you please help ?

Best regards,

RamanaV
Posts: 44
Joined: Thu Oct 19, 2017 12:57 pm

Re: SUMX result in power pivot

Postby RamanaV » Tue Jan 14, 2020 2:20 pm

SUMX is an aggregation function. That is why you are getting the same result (which is actually the sum of all the products) in every row.
You can add a calculated column as
= Base[Price]*Base[Quantidade]
And, it serves the purpose.

However, it is not a good practice to add a calculated column in the data model.
There are some best practices you need to follow while using Power Pivot.
Please refer to Matt Allington's blog articles here.
https://exceleratorbi.com.au/calculated ... sures-dax/
https://exceleratorbi.com.au/best-pract ... -power-bi/

If you need to add a column, do it in Power Query and not in the data model.
I have shown the differences in the attached workbook.
Hope it is helpful
Attachments
Adding a product column.xlsx
(184.28 KiB) Downloaded 2 times
Ramana Varanasi
Training and Office Manager
Excelerator BI Pty. Ltd.


Return to “Help with the Book "Learn to Write DAX"”

Who is online

Users browsing this forum: No registered users and 1 guest