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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ALEKSGOD
Helper I
Helper I

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 @ALEKSGOD ,

 

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 @ALEKSGOD ,

 

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.