Forum Discussion

TimK's avatar
TimK
Helper III
2 years ago
Solved

Matrix issue

I am trying to achieve something in both PowerBI and Excel

 

Basically i have some data:

Sales PersonProductSpent2023202420252026
SimonOne     2,500.00     2,125.00     2,125.00     2,125.00        452.00
SimonTwo        125.00     2,215.00         215.00 
JohnOne      2,203.00        225.00  
JohnTwo      2,335.00      2,024.00 
JohnThree         112.00     3,225.00      2,125.00
PeterOne      2,025.00     3,354.00     3,220.00     2,152.00
PeterTwo         253.00        252.00  

 

I have formatted the data and unpivoted the data in the years

 

The result i get in Excel is:

Sales PersonSpent2023202420252026Grand Total
John(blank)4,650.003,450.002,024.002,125.0012,249.00
Peter(blank)2,278.003,606.003,220.002,152.0011,256.00
Simon1252,215.00 215.00 2,430.00
Simon25002,125.002,125.002,125.00452.006,827.00
Grand Total 11,268.009,181.007,584.004,729.0032,762.00

 

The issue is the rows for "Simon" are split out for each row of "Spent"

 

What i really want to achieve in PowerBI and Excel is a table that looks like this:

Sales PersonSpent2023202420252026Grand Total
John (blank)       4,650.00      3,450.00      2,024.00      2,125.00    12,249.00
Peter (blank)       2,278.00      3,606.00      3,220.00      2,152.00    11,256.00
Simon      2,625.00      4,340.00      2,125.00      2,340.00         452.00      9,257.00
Grand Total      2,625.00    11,268.00      9,181.00      7,584.00      4,729.00    32,762.00

 

Could someone help me please?

 

Thanks

  • Hi TimK ,

     

    From your description it sounds like you have just missed the transformation to unpivot the 'spent' column as well as the years? Just apply the same transformation logic you are using for years to the 'spent' column.

     

    Hope this helps.

     

     

1 Reply

  • BITomS's avatar
    BITomS
    Solution Supplier

    Hi TimK ,

     

    From your description it sounds like you have just missed the transformation to unpivot the 'spent' column as well as the years? Just apply the same transformation logic you are using for years to the 'spent' column.

     

    Hope this helps.