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

Multiply rows within same table

Hi, 

 

How should a measure be written where each row in a table should be multiplied with a specific row from same table. In this simplified table B and C should be multiplied with A. And the column subtotals should add up correctly.

 

 Code1/20222/2022
 A1012
 B100100
 C200200
    
    
A x B =B10001200
A x C =C20002400
1 ACCEPTED SOLUTION

Hi, @Anonymous 

 

Measure: 

Total = IF(HASONEVALUE('Table'[Date]),[Measure],SUMX('Table',[Measure]))

Result:

vzhangti_0-1663225302227.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

This function controls the output of Total.
IF
(HASONEVALUE(Columns), Value, Total).

Sample data:

vzhangti_0-1663221337213.png

Measure:

Measure = 
Var _A=CALCULATE(SUM('Table'[Price]),FILTER(ALL('Table'),[Code]="A"&&[Date]=SELECTEDVALUE('Table'[Date])))
Var _B=CALCULATE(SUM('Table'[Price]),FILTER(ALL('Table'),[Code]="B"&&[Date]=SELECTEDVALUE('Table'[Date])))
Var _C=CALCULATE(SUM('Table'[Price]),FILTER(ALL('Table'),[Code]="C"&&[Date]=SELECTEDVALUE('Table'[Date])))
Return
IF(SELECTEDVALUE('Table'[Code])="A",BLANK(),IF(SELECTEDVALUE('Table'[Code])="B",_A*_B,_A*_C))

Result:

vzhangti_1-1663221465856.png

Total = IF(HASONEVALUE('Table'[Date]),[Measure],SUM('Table'[Price]))

Result:

vzhangti_2-1663221587124.png

Hope this function is applied to help you.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi, 

 

Thanks for your input, maybe with some modification your solution might work. In the result matrix I would need these sums:

B 1000+1200 = 1200
C 2000+2400 = 4400

Hi, @Anonymous 

 

Measure: 

Total = IF(HASONEVALUE('Table'[Date]),[Measure],SUMX('Table',[Measure]))

Result:

vzhangti_0-1663225302227.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi, this is the result I expect. However, I would need to define up to 30 variables (as examples B and C in your example). Would there be a different way to do it? Variable A is ok and should always be used to multiply B, C, D, E...

Anonymous
Not applicable

I managed to get the multiplying to work, now I am just struggeling with the column subtotals, I need the subtotal to add up all the results,  not price x volume . This seems to be a commin problem with DAX?

 

celenius_0-1663186960589.png

 

Anonymous
Not applicable

How did you format your table like that. that combinated headers?

Anonymous
Not applicable

Do you want to sum Result column?

Anonymous
Not applicable

Yes, I want to sum the results from the all individual months, I do not want the column subtotal to be calculated as [price] x [volume].

Anonymous
Not applicable

where are the months. i only can see december

Anonymous
Not applicable

That was just a snapshot, here are

4 months. 

celenius_0-1663208820127.png

 

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.