Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Soc3
Helper I
Helper I

Sum Removing Duplicates

Soc3_0-1752250277130.png

In this data set, I need the cancelled out values (the 1st and 3rd lines) to show as 0 in a column so I can only sum the total amount ($833) once. There are other columns in the table, I just need the sum per unique ID. Distinct, max and min functions don't work. How can I achieve the desired result?

 

Thank you in advance! 

1 ACCEPTED SOLUTION
v-ssriganesh
Community Support
Community Support

Hello @Soc3,

We hope you're doing well. Could you please confirm whether your issue has been resolved or if you're still facing challenges? Your update will be valuable to the community and may assist others with similar concerns.

Thank you.

View solution in original post

6 REPLIES 6
v-ssriganesh
Community Support
Community Support

Hello @Soc3,

We hope you're doing well. Could you please confirm whether your issue has been resolved or if you're still facing challenges? Your update will be valuable to the community and may assist others with similar concerns.

Thank you.

v-ssriganesh
Community Support
Community Support

Hello @Soc3,

Hope everything’s going great on your end! Just checking in has the issue been resolved, or are you still running into problems? Sharing an update can really help others facing the same thing.

Thank you.

v-ssriganesh
Community Support
Community Support

Hello @Soc3,
Thank you for reaching out to the Microsoft Fabric Forum Community.

I have reproduced your scenario in Power BI and successfully achieved the expected result ensuring that cancelling amounts (e.g., +980 and -980) are zeroed out so that only the actual valid transaction (e.g., 833) is retained and summed.

For your reference, I’ve attached the .pbix file demonstrating this solution.

If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

rohit1991
Super User
Super User

Hi @Soc3 
You can achieve this in Power BI by creating a measure that only sums values that don’t cancel each other out (for example, when the sum per Unique ID is not zero). Here’s a direct DAX approach. Create a measure to sum only non-cancelled amounts per Unique ID:

Net Total Amount = 
VAR NetSum = SUMX(
    VALUES('YourTable'[Unique ID]), 
    CALCULATE(SUM('YourTable'[Total Amount (USD)]))
)
RETURN
IF(NetSum <> 0, NetSum, 0)

 

To display in your table. Use Unique ID and this new Net Total Amount measure. If you want a calculated column for row-level logic, you can mark rows as zero when they are pairs that sum to zero using grouping and logic in Power Query, but for visuals, a measure like above is best. 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
Ashish_Mathur
Super User
Super User

Hi,

A simple drag and drop (as shown in your screenshot) should have worked.  My guess is that in the entries of the Unique ID column, the ID's have extra invisible characters.  Clean the data in that column.  Refresh All.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
MasonMA
Community Champion
Community Champion

@Soc3 

 

Hi, you would need to show the entire table. With limited information I'd recommend using Power Query to transform your data a bit more again. 

In Power Query, Group by Unique ID and apply below logic to handle cancellations:
- In Power Query Editor, select your table.
- Go to 'Transform', and then 'Group By'
- Group by 'Unique ID' and aggregate 'Sum of Total Amount (USD)' with `Sum`.
- Nomally this will automatically cancel out positive/negative values for the same ID.

 

After transforming in Power Query, load your data in Power BI for reporting. 

Hope it helps:) 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors