Calculate SLOPE value in PowerBI for given x and y values

vds1

Well-known Member
Joined
Oct 5, 2011
Messages
1,200
Hello,

Thank you for looking into my question.

I have series of x_value and y_value. I am looking for excel equivalent SLOPE function in PowerBI. Can you please help me with measure to calculate SLOPE for below data points?

Expected Output SLOPE (m) = 1.34556304295796


y_valuex_value
0.020.02
0.00-0.01
0.000.01
0.090.06
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I was able to find the answer in web. TblData is the name of the Table with x_value and y_value as field. The Slope can be calculated as below:

Power Query:
Slope =
Var AvgX = CALCULATE(AVERAGE(TblData[x_value]),all(TblData))
Var AvgY = CALCULATE(AVERAGE(TblData[y_value]),all(TblData))
RETURN DIVIDE(sumx(TblData,(TblData[x_value]-AvgX) * (TblData[y_value] - AvgY)),
              sumx(TblData,(TblData[x_value] - AvgX) * (TblData[x_value] - AvgX)))
 
Upvote 0
Solution

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top