Forum Discussion

ITMSPMAN's avatar
ITMSPMAN
New Member
4 years ago
Solved

Summarise on multiple columns

Is there a way that I can merge the values based on multiple columns?

 

My table is below with the layout of the data.

 

What I want to happen is if the Client, Item number, the description and the price is the same then it would sum the quantity and merge them all into one row.

 

DateClientItem NumberDescriptionPriceQuantityInvoice No.
14/01/2022John Doe04_102_0136_6_1_TGroup Activities59.8816370
14/01/2022John Doe04_102_0136_6_1_TGroup Activities59.882.56370
14/01/2022John Doe04_102_0136_6_1_TGroup Activities59.883.336370
14/01/2022John Doe04_104_0125_6_1_TGrp Non Face to Face59.671.56370
14/01/2022John Doe04_599_0136_6_1Community Groups2.171.676370
14/01/2022John Doe04_599_0136_6_1Community Groups2.172.56370
14/01/2022John Doe04_599_0136_6_1Community Groups2.1746370
14/01/2022John Doe04_599_0136_6_1Group Activities2.1716370
14/01/2022John Doe04_599_0136_6_1Group Activities2.172.56370
14/01/2022John Doe04_599_0136_6_1Group Activities2.173.336370
       
       
       
       
       
       
       
  • Hi ITMSPMAN ,

     

    If you add your Client, Item number, the description and the price columns on your visual and  mark price column summerized as sum then it will give you expected output.

    Or if you want to do it explicitly then you can use below measure:-

    Measure = sumx(SUMMARIZE('Table','Table'[Item Number],'Table'[Client],'Table'[Description],"Sum",CALCULATE(SUM('Table'[Price]))),[Sum])

     

    Thanks,

    Samarth

2 Replies

  • Samarth_18's avatar
    Samarth_18
    Icon for Community Champion rankCommunity Champion

    Hi ITMSPMAN ,

     

    If you add your Client, Item number, the description and the price columns on your visual and  mark price column summerized as sum then it will give you expected output.

    Or if you want to do it explicitly then you can use below measure:-

    Measure = sumx(SUMMARIZE('Table','Table'[Item Number],'Table'[Client],'Table'[Description],"Sum",CALCULATE(SUM('Table'[Price]))),[Sum])

     

    Thanks,

    Samarth

    • ITMSPMAN's avatar
      ITMSPMAN
      New Member

      I figured out why I couldn't get it working, I had the quantity field as a text so it wasn't summarising.

       

      I have it all working now, thankyou for pointing me in the right direction.