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! Request now

Reply
Joris_NL
Helper III
Helper III

Remove sum of balance=0 in power query

Hi,

 

Is it possible - and if so, how - to remove payments with a sum of balance =0 with a power query?

 

It's a heavy data set and it needs to be cleaned up BEFORE working with the data for graphs etc. I thought it would be best to filter as much as possible in the power query to reduce calculation time in the dashboard.

 

So this is a simplification of the data set:

 

Timm   aug     300

Lenard  aug    300

Lenard  aug   -300

James   aug    300

James   sep    500

James   aug   -300

 

This creates major problems for me: the number of people paid this year is 3, though in reality 2 (not Lenard), and in august it's only 1 instead of 3. The average cost per person or per month becomes a mess now. Keep in mind this is a simplification, and we are going to need a lot of visuals and calculations depending on age, company, starting date, ending date, region, etc, etc, and all those mixed as well.

 

Any ideas?

I was thinking about a duplicate table, then pivot to total sum per person/per month, then generate some kind of key column to link the original table with the pivot table, and then remove the sum=0 data.

 

Is there a better way? And is this even possible?

 

Thanks in advance, I hope it makes some sense.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Joris_NL ,

New Measure =

var _sum=  sum(Table[Amount]), Allexcept(Table, Table[Name], Table[Month]) )

return

calculate(Sum(Table[Amount]), filter(Table, _sum<> 0))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Joris_NL ,

New Measure =

var _sum=  sum(Table[Amount]), Allexcept(Table, Table[Name], Table[Month]) )

return

calculate(Sum(Table[Amount]), filter(Table, _sum<> 0))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for your help! Finally got time to look at it, but don't get it to work.
There is a closing bracket too many in the first row.

Also, the first comma gives an 'Unexpected expression' error message. Tried semicolons instead of comma's, but the result was the same. Just to be clear, this is my dax:

 

NewMeasure =
var _sum= sum(FEITBOEKINGDETAIL[mBedrag]), allexcept(FEITBOEKINGDETAIL, FEITBOEKINGDETAIL[xFinspecnr], FEITBOEKINGDETAIL[rBetrekkingopjaar])
return
calculate(Sum(FEITBOEKINGDETAIL[mBedrag], filter(FEITBOEKINGDETAIL, _sum<>0))

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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