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 for grouped rows

Hi,

I need help with Power Bi function.
So I have many order numbers that are sometimes repeated in many rows.
Factor = columnx/columny
I want to calculate column that shows factor for specific order number not for row.
Order number 213  (2+6+15)/(2+2+3) = 3,28

Order numbercolumnxcolumnyFactor
213223,28
213623,28
2131533,28
2142043,5
214843,5
215422
2161892,36
216822,36


I have the biggest problem to make caclucation for specific order number. Any ideas how to calculate it?
Thanks,
Aleks

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please create a new column:

Column = 
var sum_columnx = CALCULATE(SUM('Table'[columnx]),FILTER(ALL('Table'),'Table'[Order number] = EARLIER('Table'[Order number])))
var sum_columny = CALCULATE(SUM('Table'[columny]),FILTER(ALL('Table'),'Table'[Order number] = EARLIER('Table'[Order number])))
return
DIVIDE(sum_columnx,sum_columny)

 

Result:

vyadongfmsft_0-1671072341868.png

 

Best regards,

Yadong Fang

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

1 REPLY 1
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please create a new column:

Column = 
var sum_columnx = CALCULATE(SUM('Table'[columnx]),FILTER(ALL('Table'),'Table'[Order number] = EARLIER('Table'[Order number])))
var sum_columny = CALCULATE(SUM('Table'[columny]),FILTER(ALL('Table'),'Table'[Order number] = EARLIER('Table'[Order number])))
return
DIVIDE(sum_columnx,sum_columny)

 

Result:

vyadongfmsft_0-1671072341868.png

 

Best regards,

Yadong Fang

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

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.

Top Solution Authors