Forum Discussion

Maggi029's avatar
Maggi029
Icon for Helper II rankHelper II
4 years ago
Solved

How to combine duplicate rows and sum its values

How to combine duplicate rows and sum its values

 

Example of my table

 

CategoryItemsItems CountSell Date
FruitsApple    329/10/2021
FruitsApple    229/10/2021
VegetableCarrot    329/10/2021
VegetableCarrot    229/10/2021
FruitsApple    130/10/2021

 

I need to get my table like this:

 

CategoryItemsItems CountSell Date
FruitsApple      529/10/2021
VegetableCarrot      529/10/2021
FruitsApple      130/10/2021

 

How i can i acheive this?

  • Oh okay, In that case you can follow below steps:-

    1. Click on group by option in edit query window:-

     

    2. Then select column as below and click OK:-

    3, You will see below output and then click on close and apply:-

     

     

     

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello Maggi029 

    You can create a simple measure and plot in the table/matrix.

    Total Items = SUM'Table'[Items Count] )
    • Maggi029's avatar
      Maggi029
      Icon for Helper II rankHelper II

      Hi Anonymous 

       

      No instead of measure, i need to trim down my table rows count, for i need to combine my rows

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

    Hi Maggi029 ,

     

    You can achive this by below two ways:-

     

    1. Drag your column on table visual and use item count as sum 

     

    2. Or You can create a custom table with below code:-

     

    Table 2 =
    SUMMARIZE (
        'Table',
        'Table'[Category],
        'Table'[Items],
        'Table'[Sell Date],
        "sum", SUM ( 'Table'[Items Count] )
    )

     

    Thanks,

    Samarth

    • Maggi029's avatar
      Maggi029
      Icon for Helper II rankHelper II

      Hi Samarth_18 

       

      Thanks for your response; it appears to be satisfactory; however, I must continue to use the old table in my project, as this will increase my pbix weight. My main goal is to reduce my pbix size, and to do so, I must trim down the table.

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

        Oh okay, In that case you can follow below steps:-

        1. Click on group by option in edit query window:-

         

        2. Then select column as below and click OK:-

        3, You will see below output and then click on close and apply:-