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
Anonymous
Not applicable

Multiplication of two measures over two columns

Hi Team,

I have a table visual wherein I have two columns and two measures(sample data below).
pdt and cst are two columns from two different dimensions and m1 and m2 are two measures from different fact tables

pdtcstm1m2
AAA2010
BBB505
CCC5020
DDD6030



I need to multiply m1 and m2 row by row and then sum the entire values.Then divide it by sum of values of m1 measure.
For example:
20*10 = 200
50*5 = 250
50*20 = 1000
60*30 = 1800
and then SUM(200+250+1000+1800)/SUM(20+50+50+60) as the final value.

 

I have tried using SUMX  like below-
DIVIDE(SUMX(VALUES(TablePdt[pdt]),m1*m2),CALCULATE(m1, ALL(TablePdt[pdt])))

However, I actually have two columns here - pdt and cst, and I cannot use two tables in SUMX expression.

 

Is this requirement achievable? Please suggest

Any help would be highly appreciated.

 

Thanks,
Sam

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Assume you have Table1, Table 2, and M1 and M2 are measures from those. And you have common dim1 and dim2

 

divide(Sumx(Summarize(Table1,dim1[pdt],dim2[cst],"_1",[M1]*[M2]),[_1]),[M2])

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Assume you have Table1, Table 2, and M1 and M2 are measures from those. And you have common dim1 and dim2

 

divide(Sumx(Summarize(Table1,dim1[pdt],dim2[cst],"_1",[M1]*[M2]),[_1]),[M2])

Anonymous
Not applicable

Thanks @amitchandak .It worked:)

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.