Forum Discussion

ArtVandelay's avatar
ArtVandelay
New Member
4 years ago

Correlation coefficient "Blank" undefined

I am new to Power BI.  I have a very simple table of 43 rows.  Excerpt below.  There are no blanks or zeros in the last two columns. 

 

I was able to get a scatter plot and trend line.  But when using the Quick Measure for the correlation coefficient, it returns "(Blank)".

 

What am I doing wrong?

Excerpt of table

 

 

Results in this DAX

 

Count of Direct Hire Jobs and Count of Direct Hire Revenue correlation for Direct Hire Revenue =
VAR __CORRELATION_TABLE = VALUES('Sheet2'[Direct Hire Revenue])
VAR __COUNT =
    COUNTX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(
            COUNTA('Sheet2'[Direct Hire Jobs])
                * COUNTA('Sheet2'[Direct Hire Revenue])
        )
    )
VAR __SUM_X =
    SUMX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(COUNTA('Sheet2'[Direct Hire Jobs]))
    )
VAR __SUM_Y =
    SUMX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(COUNTA('Sheet2'[Direct Hire Revenue]))
    )
VAR __SUM_XY =
    SUMX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(
            COUNTA('Sheet2'[Direct Hire Jobs])
                * COUNTA('Sheet2'[Direct Hire Revenue]) * 1.
        )
    )
VAR __SUM_X2 =
    SUMX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(COUNTA('Sheet2'[Direct Hire Jobs]) ^ 2)
    )
VAR __SUM_Y2 =
    SUMX(
        KEEPFILTERS(__CORRELATION_TABLE),
        CALCULATE(COUNTA('Sheet2'[Direct Hire Revenue]) ^ 2)
    )
RETURN
    DIVIDE(
        __COUNT * __SUM_XY - __SUM_X * __SUM_Y * 1.,
        SQRT(
            (__COUNT * __SUM_X2 - __SUM_X ^ 2)
                * (__COUNT * __SUM_Y2 - __SUM_Y ^ 2)
        )
    )
 
Sadly, this is the response.

 

 

1 Reply