Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rcspaiva
Helper I
Helper I

Results on rows is correct, but grand total give more than expected.

Hello,

 

I'm trying get a result of a simple mutiplication between a measure and a column but It's getting wrong.

Does anyone know what can I try to solve it?

 

SEQPRODUTO = Column

 

Novo preço = Column

 

Quantidade projetada = Measure (I cant transform in a column, because has a measure for calc of elasticity to each product )

 

Faturamento projetado = Measure (My problematic total)

 

 

Capturar.PNG

 

The funniest part is, when I export to excel, my total give correct.

 

Thx in advance!!!

1 ACCEPTED SOLUTION

Hey, 

 

as far as I can see, the wrong value comes from the fact, that the your measure sums up when there is no product that "contributes" to the current Filter Context.

 

For this reason try this measure

measure = 
  CALCULATE(
    SUMX(
      VALUES('yourtable'[idproduct])
      ,'yourtable'[price] * [Quantity]
  )

If idproduct is on rows than the table returned by VALUES() just contains one row, on the TOTAL level VALUES() contains all the product available in the current filter context.

 

On the Total level SUMX() iterates over each product, determines the price on row level and multiplies with the measure [Quantity]

 

Be aware that there is a subtle difference to your measure, here the multiplication happens inside of SUMX( table, expression), where table is given by VALUES() and expression by column * [measure].

 

Hope this helps

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

 

What calculated field formula have you written to compute the values in the last column?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello my friend, thx for u reply.

 

Reply to Message - Microsoft Power BI Community.png

 

 

I'm getting crazy with this problem... >.<

Hi,

 

I cannot understand your requirement.  Do you simply want to add/subtract.  If that be the case, then why are you using the SUMX function.  Please describe the business question and show your expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

what I need is find a muplication of each row and a correct grand total of these numbers at the last row.

 

In first column there is a kind of IDproduct (column).

In the second one, a column which has a price for each IDproduct (column).

At the third, there are a result which comes from measure that bring a quantity of sales projetion.

At the fourth I want see the total of sales expected for each IDproduct, and in last row the grand total corretly.

 

ID product(comes from column)Price (comes from a column)Quantity (comes from a measure) Total (Measure with problem) 
999101001000Total of each row
1000202004000 
100130130 
200140280 
3002504200 
400460503000 
   8310 
   Grand Total what I'm talking about. 

 

 

 

Translated

 

Weberton.png

 

 

Sorry about my english... ;D

 

 

Hey, 

 

as far as I can see, the wrong value comes from the fact, that the your measure sums up when there is no product that "contributes" to the current Filter Context.

 

For this reason try this measure

measure = 
  CALCULATE(
    SUMX(
      VALUES('yourtable'[idproduct])
      ,'yourtable'[price] * [Quantity]
  )

If idproduct is on rows than the table returned by VALUES() just contains one row, on the TOTAL level VALUES() contains all the product available in the current filter context.

 

On the Total level SUMX() iterates over each product, determines the price on row level and multiplies with the measure [Quantity]

 

Be aware that there is a subtle difference to your measure, here the multiplication happens inside of SUMX( table, expression), where table is given by VALUES() and expression by column * [measure].

 

Hope this helps

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hey @TomMartens, I'm a newb on power bi, so I need understand better some concepts. Your solution simply has worked perfectly, and your explanation came in a good moment.

 

I already wasted almost two days on this, and in another similar case.

 

Thank u so much!

 

 

 

 

 

 

 

 

You're welcome, glad my solution did work for you 😉

 

Cheers

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi,

 

Share the link from where i can download your file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.