This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
So I have this table with locations named with IDs. Each ID can have data from multiple years, and multiple metric types. I want to merge and sum all the Water + Irrigation rows with matching ID/Year, and leave all the rest as-is. I want to do this in transform data, because I have other things I need to do with this table and data. Is this possible?
Original Table:
| Row | ID | Year | Metric Type | January Use |
| 1 | 12 | 2022 | Water | 25 |
| 2 | 12 | 2022 | Irrigation | 55 |
| 3 | 12 | 2021 | Electrcitiy | 28160 |
| 4 | 12 | 2022 | Electricity | 19760 |
| 5 | 423 | 2022 | Water | 46 |
| 6 | 423 | 2022 | Irrigation | 33 |
| 7 | 423 | 2022 | Natural Gas | 6340 |
8 | 89 | 2021 | Electricity | 21780 |
| 9 | 89 | 2022 | Natural Gas | 180 |
| 10 | 55 | 2022 | Water | 11 |
Desired Table
| Row | ID | Year | Metric Type | January Use |
| 1 | 12 | 2022 | Water | 80 |
| 2 | 12 | 2021 | Electrcitiy | 28160 |
| 3 | 12 | 2022 | Electricity | 19760 |
| 4 | 423 | 2022 | Water | 79 |
| 5 | 423 | 2022 | Natural Gas | 6340 |
6 | 89 | 2021 | Electricity | 21780 |
| 7 | 89 | 2022 | Natural Gas | 180 |
| 8 | 55 | 2022 | Water | 11 |
Solved! Go to Solution.
My suggestion would be to replace Irrigation as Water using replace values and then group by ID, Year and Metric Type, summing the January Use row. You can add in an index column after if it is needed.
Proud to be a Super User! | |
@Anonymous Sure, there is the ability to group rows in Power Query or you can use SUMMARIZE or GROUPBY in DAX.
My suggestion would be to replace Irrigation as Water using replace values and then group by ID, Year and Metric Type, summing the January Use row. You can add in an index column after if it is needed.
Proud to be a Super User! | |
This was such a simple step forward, thank you!
Something I left out of my original solution was that I have multiple columns (one for each month), that I needed summed separately, but I actually just unpivoted them, then grouped by ID, Year, Month, and Metric and that seems to have done the trick!
@Anonymous Unpivot for the win!
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 36 | |
| 28 | |
| 28 | |
| 20 | |
| 18 |
| User | Count |
|---|---|
| 65 | |
| 35 | |
| 34 | |
| 25 | |
| 24 |