4 Replies Latest reply on Dec 13, 2017 11:10 PM by Arshad Nawaz

# Calculating R2 and P values

This is in reference to this thread. Formula for R2 and P values for Trend Lines

Having trouble to mimic the fomulas embedded in the sample workbook in the above mentioned thread by Bora Beran

The main issue with data types on the x and y axis. I could get this working for two continuous variables.

In my situation:

x -axis is a time period which I am tackling by using the float(date) method (Posted by Andrew Hill)

y-axis is an already aggregated variables which is not fitting well in the covariance calculation.

{fixed [Category] : SUM(([Weekly Profit] - {fixed [Category] : AVG([Weekly Profit])})*([Weekly Sales] - {fixed [Category] : AVG([Weekly Sales])}))}

/({fixed [Category] : SUM([Number of Records])} -1)

In this formula Weekly Profit where I have to put my Y-axis variable but it is already aggregated prior and does now fit in this equation.

Any remedy to this will be helpful

• ###### 1. Re: Calculating R2 and P values

Bora Beran may be able to help here.  Thank you for the detailed question.

Patrick

• ###### 2. Re: Calculating R2 and P values

You can nest LOD expressions or use table calcs if your data is aggregated.

I need more context before I can help more. Please share the packaged workbook.

1 of 1 people found this helpful
• ###### 3. Re: Calculating R2 and P values

Attaching the workbook. Trying to pull out the p values and R2 of the trend lines plotted on this simple line graph.

Hopefully the method should also update the values when new filters are introduced.

• ###### 4. Re: Calculating R2 and P values

Bora Beran I have attached the workbook which needs the calculations of p values and R2. Could you please help with the calculations. Thanks in advance.