cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Row by row multiplication - how to get the correct sum

So again I am trying to do row by row multiplicaiton using measures, and I end up with the wrong sum.

 

The first expression below, Sales_Uncleaned, all seems to work, the correct sum is achieved, on total and on all aggregated categories.

 

 Sales_Uncleaned = Divide(Maxx(RELATEDTABLE(Combined);Combined[Sales_2019]) ;                             Maxx(RELATEDTABLE(Combined);Combined[Potential_2019]))     
 
In the second step I want to multiply the first expression with a factor to get the Sales_Cleaned;
Sales_Cleaned = [Sales_Uncleaned] * Combined[Factor]        (Written in 'Pseudocode')
 
I have tried using Maxx, Sumx and the values get way high. I am using % in this case for Sales_Uncleaned, and while the first expression generates double digit figures, after multiplication, I get three digit ones for example, expected is slightly lower percentages. It all works when looking at the data in a table format, at a lowest level category. But when I look at an aggregated category, or on a total, that is when the sums go crazy. So since the factor is less than 1 that I want to multiply with, the lower percentages on the right look OK! However, the total is way off, and on aggreagated sales categories, it is also way off.
 
Sales_uncleaned and cleaned wrong total.png
 
All fields are in one and the same Table. Don't know if the relation model is needed in this case, otherwise please let me know.
 
Would be much appreciating for help on the way.
3 REPLIES 3
Highlighted
Helper I
Helper I

Re: Row by row multiplication - how to get the correct sum

Hi @1up 

 

You'll want to wrap the original calc in a sumx...

 

Sales_Uncleaned:= SUMX (
    'Combined',
    DIVIDE(max('Combined'[Sales_2019]),max('Combined'[Potential_2019]))

    )

 

You may have to modify the query a bit as I am not sure what your original table looks like.

 

-Paul

Highlighted
Helper I
Helper I

Re: Row by row multiplication - how to get the correct sum

Thanks for the reply.

 

I tried, and I get wrong sums unfortunately for the starting expression, using this code. Now the %-ages are in the thousands. On individual base category it works though. I wrote as below;

 

Sales_Uncleaned = Sumx(Combined;Divide(Max(Combined[Sales_2019]); Max(Combined[Potential_2019])))
 
If I omit 'Sumx' , then it seem to summarize correctly, even on higher aggregate category-level. I am confused how this really works...
 
Any further ideas?
Highlighted
Helper I
Helper I

Re: Row by row multiplication - how to get the correct sum

Perhaps I should add, I have two categories in the table. One column is a unique category, let's call them A, B, C, D, E etc. The other one is a group which includes certain categories, so let's say Cat1 includes (A, C), Cat2 includes (B, D, E).

 

Summarizing on the aggregated Cat#-categories, gives the wrong result, and on total sum...

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors