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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculation sumX multiplication

Hello;

i'm performing my calculation with the sumX function, in a simplified way, my code has the following form:

measure=sumx(A)*sumx(B)*sumx(C)

i'm getting the results as ( A1 + A2 + A3 ...)*(B1 + B2 + B3 ...)*(C1 + C2 + C3 ...)

What should i do in order to have my calculation performed in the following form: 
(A1*B1*C1) + (A2*B2*C2) + (A3*B3*C3) + ... ?

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Here is a sample file with the solution https://www.dropbox.com/t/obELBigMGJIPqhHd

Actually I have tried the same solutions and they seem to work. The thing is it won't allow me to create the hierarchy slicer with pop-up a message saying that the relationship should be One - Many. I don't know how did you create it but arbitrarily shaped slicers usually causes trouble. Using them would require the use of KEEPFILTERS. Unfortunately I failed to simulated your case but you can refer to (2) When to use KEEPFILTERS over iterators - YouTube

Following two workable solutions but using normal slicers.

1.png2.png

View solution in original post

19 REPLIES 19
tamerj1
Super User
Super User

Hi @Anonymous 
Here is a sample file with the solution https://www.dropbox.com/t/obELBigMGJIPqhHd

Actually I have tried the same solutions and they seem to work. The thing is it won't allow me to create the hierarchy slicer with pop-up a message saying that the relationship should be One - Many. I don't know how did you create it but arbitrarily shaped slicers usually causes trouble. Using them would require the use of KEEPFILTERS. Unfortunately I failed to simulated your case but you can refer to (2) When to use KEEPFILTERS over iterators - YouTube

Following two workable solutions but using normal slicers.

1.png2.png

Anonymous
Not applicable

Hello, Thank you tamer for your help i really appreciate it!
it worked with the KEEPFILTERS function!!

tamerj1
Super User
Super User

Hi @Anonymous 
are they in the same table or different tables?

Anonymous
Not applicable

actually 2 of the values are in the same table; and if i use this  

 

this pattern = SUMX( Table, Table[ColA] * Table[ColB])

 

for the 2 values in the same table i get the right value (A1*B1)+(A2*B2)...
but it's not working when i try to add the 3rd Value (C) which is in another table

Anonymous
Not applicable

different tables

@Anonymous 
Do they have 1:1 relationships? I mean how do you know which row to multply with which row? As you mentioned (A1*B1*C1) + (A2*B2*C2) + (A3*B3*C3) + ...   or do you mean (A1*B1*C1) + (A1*B1*C2) + (A1*B1*C3) + ... ?

Anonymous
Not applicable

i'm using a many to many relationship (power bi is not accepting to put it as 1:1); and using a hierarchy slicer, i'm chosing which value C corresponds to the 1st values (A1 & B1) ...

@Anonymous 
Still not 100% clear but you may try

Measure1 =
SUMX ( Table1, SUMX ( Table2, Table1[A] * Table1[B] * Table2[C] ) )
Anonymous
Not applicable

no still doesn't work, this formula gives me:
(C1+C2)*A1*B1 + (C1+C2)*A2*B2 (if i'm working with 2 values)

@Anonymous 
Ok. Then please try

Measure1 =
SUMX ( Table1, Table1[A] * Table1[B] * SUM ( Table2[C] ) )
Anonymous
Not applicable

it gives the same value as the previous one

@Anonymous 

Measure1 =
SUMX ( Table1, Table1[A] * Table1[B] * CALCULATE ( SUM ( Table2[C] ) ) )
Anonymous
Not applicable

same value as the previous one too 😭

@Anonymous 

Yes because there are two values related to each row. I need to have a look at the data structure. Can we connect via zoom or teams? Please share a link in a private message 

Anonymous
Not applicable

Hello Again,

Sorry i didn't get back to you but the file is confidential. i prepared the tables below to better show the problem.

Manuella_2-1654676335022.png

But as seen in the photo above, i'm getting good results for each row alone. but for the total (Sum of the rows) the calculation is being perfomed in another way ( it's not simply making the sum of the calculation rows but it's it's making the sum of each column and then multiplying the results if using the measure sumx(A)*SumX(B)*sumx(C))
or

Manuella_3-1654676379049.png

if using the measure sumx(A)*sumx(B*C), it's giving a correct result for each row alone too but for the total it's giving a value of the sum of all the values of column A multiplied by the sum of the multiplication of each row in column B and C


Note: column A is in a different table than columns B and C
i would really appreciate your help in solving this issue

Hi @Anonymous 
Please try

SUMX ( 
VALUES ( Nom ),
CALCULATE ( SUMX ( A ) * SUMX ( B * C ) )
)

Anonymous
Not applicable

it gives the same value as this one sumx(A)*sumx(B*C)
To explain more on the relationships i have:
i have 2 tables (one as database (containes the type, properties, B, C) and the other as entered data (containes Type, Nom, A))
the relationship is between Type and Type in both tables, and it's a double relationship relating many-to-many.

Manuella_0-1654679125842.png

 

Manuella_1-1654679142324.png

 

So on power Bi I will choose to associate BB to Yellow and GB2 to blue (as an example, or i can associate to any other properties(color)) and the calculation should perform the multiplication of the values of BB in column A with the corresponding values of Yellow in columns B and C

CNENFRNL
Community Champion
Community Champion

Follow this pattern = SUMX( Table, Table[ColA] * Table[ColB] * Table[ColC] )

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

but the values of A, B and C are from different tables.
(i'm using a hierarchy slicer in order to choose which value corresponds to which one)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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