Forum Discussion

mmccarthy's avatar
mmccarthy
Frequent Visitor
7 years ago
Solved

Cannot group fields in Pivot Tables

I have merged three datasets - one with actual sales values, one with actual reposession values and one with targets for both. Unfortuately the targets are stored in sharepoint in excel and the others are in a postgres database so its not possible to merge these into one query and get the desired output so i need to provide the following table as an output.

 ActualTargetVariance
Sales26834777.23%
Reposessions26834777.23%

 

there should be a date filter and shop name filter included.

The way the data is structured at present is as follows:

ShopMonthSalesSales TargetReposessionsReposessions target
Shop1Jan20152015
Shop1Feb104104
Shop1Mar11151115
Shop1Apr15151515
Shop1May556556
Shop1Jun615615
Shop1Jul207207
Shop1Aug10151015
Shop1Sep11151115
Shop1Oct15151515
Shop1Nov5959
Shop1Dec615615
Shop2Jan209209
Shop2Feb10151015
Shop2Mar119119
Shop2Apr15151515
Shop2May515515
Shop2Jun6565
Shop2Jul20152015
Shop2Aug10151015
Shop2Sep118118
Shop2Oct15151515
Shop2Nov515515
Shop2Dec615615

 

I have tried a number of options but none have come close to addressing the task. Any suggestions would be much appreciated!!

Thanks

  • Hi mmccarthy ,

     

    You need to transform table structure in Query Editor first.

     

    Choose columns [Sales], [Sales Target], [Reposessions] and [Reposessions target], click "Unpivot columns".

     

    Add conditional columns.

     

    Apply above changes. In report view mode, add below measure and corresponding fields into a Matrix visual.

    Variance = CALCULATE(SUM(Table3[Value]),Table3[Category]="Actual")/CALCULATE(SUM(Table3[Value]),Table3[Category]="Target")

    Best regards,

    Yuliana Gu

1 Reply

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi mmccarthy ,

     

    You need to transform table structure in Query Editor first.

     

    Choose columns [Sales], [Sales Target], [Reposessions] and [Reposessions target], click "Unpivot columns".

     

    Add conditional columns.

     

    Apply above changes. In report view mode, add below measure and corresponding fields into a Matrix visual.

    Variance = CALCULATE(SUM(Table3[Value]),Table3[Category]="Actual")/CALCULATE(SUM(Table3[Value]),Table3[Category]="Target")

    Best regards,

    Yuliana Gu