Forum Discussion

GFire's avatar
GFire
Helper I
1 year ago
Solved

Correlation matrix

From the attached dataset, create the image matrix. Please.   Dataset Link: https://docs.google.com/spreadsheets/d/1UpU-BSpuBebzvAelfOPYFwBqZZWTv085/edit?usp=sharing&ouid=111608555157032384060&rtp...
  • v-sgandrathi's avatar
    v-sgandrathi
    1 year ago

    Hi GFire,

     

    Below is the DAX code used to create the SalesData table:

     

    SalesData =
    SELECTCOLUMNS (
    ADDCOLUMNS (
    CROSSJOIN (
    VALUES('YourUnpivotedTable'[Year]),
    VALUES('YourUnpivotedTable'[Year])
    ),
    "Sales",
    CALCULATE (
    SUM('YourUnpivotedTable'[Sales])
    )
    ),
    "Year", [Value1],
    "Compare_Year", [Value2],
    "Sales", [Sales]
    )

     

    In this code, replace Replace 'YourUnpivotedTable' with the actual name of your unpivoted base table. This DAX statement generates a table displaying all combinations of Year and Compare_Year, together with their corresponding sales values. This serves as the basis for calculating the Pearson correlation using the measure I previously provided. If you would like me to incorporate this into the PBIX file and upload the updated version, please let me know.

    Thank you.