Forum Discussion
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.
| Date | Client | Item Number | Description | Price | Quantity | Invoice No. |
| 14/01/2022 | John Doe | 04_102_0136_6_1_T | Group Activities | 59.88 | 1 | 6370 |
| 14/01/2022 | John Doe | 04_102_0136_6_1_T | Group Activities | 59.88 | 2.5 | 6370 |
| 14/01/2022 | John Doe | 04_102_0136_6_1_T | Group Activities | 59.88 | 3.33 | 6370 |
| 14/01/2022 | John Doe | 04_104_0125_6_1_T | Grp Non Face to Face | 59.67 | 1.5 | 6370 |
| 14/01/2022 | John Doe | 04_599_0136_6_1 | Community Groups | 2.17 | 1.67 | 6370 |
| 14/01/2022 | John Doe | 04_599_0136_6_1 | Community Groups | 2.17 | 2.5 | 6370 |
| 14/01/2022 | John Doe | 04_599_0136_6_1 | Community Groups | 2.17 | 4 | 6370 |
| 14/01/2022 | John Doe | 04_599_0136_6_1 | Group Activities | 2.17 | 1 | 6370 |
| 14/01/2022 | John Doe | 04_599_0136_6_1 | Group Activities | 2.17 | 2.5 | 6370 |
| 14/01/2022 | John Doe | 04_599_0136_6_1 | Group Activities | 2.17 | 3.33 | 6370 |
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
Community 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
- ITMSPMANNew 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.