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 moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
I have a table that shows widgets sold on a specific date and to a specific customer. Currently, my table shows a "1" in the units sold column to indicate a sale and a "-1" to indicate a return. I am looking for a way (preferably in Power Query, but DAX would work as well) to remove BOTH rows of the widget ID when it is returned (i.e. the sale and the return). I would also want my table to show if that specific widget ID was sold again at a later time (this means there could be 3 rows with the same widget ID). My goal is to transform my Current table to the Expected table listed below.
Note:
As you can see in the example below, I am wanting to remove Widget ID 3 because it was returned. Also note that widget ID 5 was re-sold after being returned, so I want to keep the most recent transaction in my table.
Solved! Go to Solution.
Hi @Anonymous ,
I'm not good at power query. Hope @ImkeF would help.
In addition, you could try to create the calculated table with the dax expression below.
Table 2 =
SUMMARIZE (
'Table',
'Table'[Widget ID],
'Table'[Sales Date],
'Table'[Customer],
"a", COUNTROWS ( VALUES ( 'Table'[Units Sold] ) ),
"Unit_Sold", CALCULATE ( SUM ( 'Table'[Units Sold] ) )
)
And then you could drag column[a] to visual level filter and then filter the value =1.
Best Regards,
Cherry
In Power Query:
Group on Widget ID, Sales Date and Customer and add an aggregation that sums the Units Sold. Then filter out values that return 0 on that new column.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @Anonymous ,
Have you solved your problem?
If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly?
If you still need help, please feel free to ask.
Best Regards,
Cherry
In Power Query:
Group on Widget ID, Sales Date and Customer and add an aggregation that sums the Units Sold. Then filter out values that return 0 on that new column.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @Anonymous ,
I'm not good at power query. Hope @ImkeF would help.
In addition, you could try to create the calculated table with the dax expression below.
Table 2 =
SUMMARIZE (
'Table',
'Table'[Widget ID],
'Table'[Sales Date],
'Table'[Customer],
"a", COUNTROWS ( VALUES ( 'Table'[Units Sold] ) ),
"Unit_Sold", CALCULATE ( SUM ( 'Table'[Units Sold] ) )
)
And then you could drag column[a] to visual level filter and then filter the value =1.
Best Regards,
Cherry
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.