Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
This is the data I have currently. I am trying to merge every 3 rows for each customer order. Because all cell values are the same for each order's aa to ee, I would like the data to be cleaned in a way that displays one order per row.
aa | bb | cc | dd | ee | 2020 | 2021 | 2022 |
a1 | b1 | Customer 1 | d1 | e1 | 1 | null | null |
a1 | b1 | Customer 1 | d1 | e1 | null | 1 | null |
a1 | b1 | Customer 1 | d1 | e1 | null | null | 1 |
a2 | b2 | Customer 2 | d2 | e2 | 2 | null | null |
a2 | b2 | Customer 2 | d2 | e2 | null | 2 | null |
a2 | b2 | Customer 2 | d2 | e2 | null | null | 2 |
a3 | b3 | Customer 3 | d3 | e3 | 3 | null | null |
a3 | b3 | Customer 3 | d3 | e3 | null | 3 | null |
a3 | b3 | Customer 3 | d3 | e3 | null | null | 3 |
a4 | b4 | Customer 4 | d4 | e4 | 4 | null | null |
a4 | b4 | Customer 4 | d4 | e4 | null | 4 | null |
a4 | b4 | Customer 4 | d4 | e4 | null | null | 4 |
This is the output I'm looking for:
aa | bb | cc | dd | ee | 2020 | 2021 | 2022 |
a1 | b1 | Customer 1 | d1 | e1 | 1 | 1 | 1 |
a2 | b2 | Customer 2 | d2 | e2 | 2 | 2 | 2 |
a3 | b3 | Customer 3 | d3 | e3 | 3 | 3 | 3 |
a4 | b4 | Customer 4 | d4 | e4 | 4 | 4 | 4 |
How can I do this? Really appreciate your help!
Solved! Go to Solution.
Hi @Anonymous ,
You can use the Group By functionality. You can find this either on the transform tab of Power Query, or right click on a column header and select 'Group By' from the list.
You will then need to select 'Advanced' and use your aa to ee columns as the groupings, and create aggregations for your years columns (I think SUM operation is appropriate for your use case). For example:
Hope this helps!
Hi @Anonymous ,
Your solution is great, @BITomS . Here I have another idea in mind, and I would like to share it for reference.
You can create a new table and use the DAX code as follows:
CalculatedTable =
SUMMARIZE(
OriginalTable,
OriginalTable[cc],
"aa", MAX(OriginalTable[aa]),
"bb", MAX(OriginalTable[bb]),
"dd", MAX(OriginalTable[dd]),
"ee", MAX(OriginalTable[ee]),
"2020", MAX(OriginalTable[2020]),
"2021", MAX(OriginalTable[2021]),
"2022", MAX(OriginalTable[2022])
)
A new table CalculatedTable is created, and the result is as follows:
If you have any other questions please feel free to contact me.
Best Regards,
Zhu
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
This is perfect - thank you!
Hi @Anonymous ,
Your solution is great, @BITomS . Here I have another idea in mind, and I would like to share it for reference.
You can create a new table and use the DAX code as follows:
CalculatedTable =
SUMMARIZE(
OriginalTable,
OriginalTable[cc],
"aa", MAX(OriginalTable[aa]),
"bb", MAX(OriginalTable[bb]),
"dd", MAX(OriginalTable[dd]),
"ee", MAX(OriginalTable[ee]),
"2020", MAX(OriginalTable[2020]),
"2021", MAX(OriginalTable[2021]),
"2022", MAX(OriginalTable[2022])
)
A new table CalculatedTable is created, and the result is as follows:
If you have any other questions please feel free to contact me.
Best Regards,
Zhu
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
This worked - thank you so much!
Hi @Anonymous ,
You can use the Group By functionality. You can find this either on the transform tab of Power Query, or right click on a column header and select 'Group By' from the list.
You will then need to select 'Advanced' and use your aa to ee columns as the groupings, and create aggregations for your years columns (I think SUM operation is appropriate for your use case). For example:
Hope this helps!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |