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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
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,225,738
Messages
6,186,728
Members
453,368
Latest member
positivemind

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