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
Nyx
Frequent Visitor

Correlation Coefficient different between excel and Power bi

Can someone tell me what I have done differently please?

 

I have the quick measure in power bi, correlation coefficient, category column A, measure x column B and measure y column C. This gave me 0.9882 (to 4 decimals)

 

In excel I have simple used =Correl() function for A & B columns and have got 0.968161112

 

dateAB
01/01/201700
01/02/20172005
01/03/201730010
01/04/201740016
01/05/201730011
01/06/20172004
01/07/201750026
01/08/201760029
01/09/20172004
01/10/20171001
01/11/20173009
01/12/20172004
1 ACCEPTED SOLUTION

Please, 

i think the problem is in your data

control them 

you can also try again with the data you posted here and you will get the right result

View solution in original post

4 REPLIES 4
serpiva64
Solution Sage
Solution Sage

Hi,

you only need to increase the number of decimals

serpiva64_0-1668165210859.png

If this post is useful to help you to solve your issue consider giving the post a thumbs up 

 and accepting it as a solution !

 

Nyx
Frequent Visitor

Thank you for taking a look for me. I must be doing something wrong in Power bi, i've increased the decimals and got 0.988171688836408

Have I done something wrong here?

 

Nyx_0-1668166975871.png

 

 

A and B correlation for date =
VAR __CORRELATION_TABLE = VALUES('Table'[date])
VAR __COUNT =
    COUNTX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(SUM('Table'[A]) * SUM('Table'[B]))
    )
VAR __SUM_X = SUMX(KEEPFILTERS(__CORRELATION_TABLE), CALCULATE(SUM('Table'[A])))
VAR __SUM_Y = SUMX(KEEPFILTERS(__CORRELATION_TABLE), CALCULATE(SUM('Table'[B])))
VAR __SUM_XY =
    SUMX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(SUM('Table'[A]) * SUM('Table'[B]) * 1.)
    )
VAR __SUM_X2 =
    SUMX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(SUM('Table'[A]) ^ 2)
    )
VAR __SUM_Y2 =
    SUMX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(SUM('Table'[B]) ^ 2)
    )
RETURN
    DIVIDE(
        __COUNT * __SUM_XY - __SUM_X * __SUM_Y * 1.,
        SQRT(
            (__COUNT * __SUM_X2 - __SUM_X ^ 2)
                * (__COUNT * __SUM_Y2 - __SUM_Y ^ 2)
        )
    )

Please, 

i think the problem is in your data

control them 

you can also try again with the data you posted here and you will get the right result

Nyx
Frequent Visitor

I did, I found it, thank you. I had a different value in the dummy figures.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors