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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
WeihsMichael
New Member

sum column A based on values in column B

WeihsMichael_0-1641810133303.png

Last column (3.754.621) should only total up values if column before (3.400.580) contains values (so the last 3 rows should not be part of the total, currently they are). Both data fields are within the same table.

 

If you have suggestions, they are more than welcome.

 

Thx, Michael

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@WeihsMichael  you can write a measure like this

_val2 = CALCULATE(SUM(t2[val2]),FILTER(t2,t2[val1]<>BLANK()))

 

smpa01_0-1641824474733.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

17 REPLIES 17
smpa01
Super User
Super User

@WeihsMichael  you can write a measure like this

_val2 = CALCULATE(SUM(t2[val2]),FILTER(t2,t2[val1]<>BLANK()))

 

smpa01_0-1641824474733.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

WeihsMichael_0-1641826083992.png

Thanks, tried but get a syntax error.

@WeihsMichael  that is because you did not close parenthesis after 

SUM(tbl[column]
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Thx, changed it but strange things happened, some rows show wrong values now, some show no values at at 🙂

WeihsMichael_0-1641828009234.pngWeihsMichael_1-1641828061332.pngWeihsMichael_2-1641828114654.png

 

@WeihsMichael  provide a sample pbix but uploading it in 1/g drive and share the link here

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Can I send the pbix via email?

@WeihsMichael  did not work

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Samarth_18
Community Champion
Community Champion

Hi @WeihsMichael ,

 

You can create a new column with below code and use it instead:-

column = if(column B <> blank(),column A)

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

WeihsMichael_0-1641819346719.png

Hi Samarth, thanks for posting the DAX line, it almost worked except for the total remaining unchanged. Maybe you have a clue?

 

Column C = IF('ZV Vertrieb'[Aboumsatz] <> BLANK(),'ZV Vertrieb'[Aboumsatz VJ],'ZV Vertrieb'[Aboumsatz])

@WeihsMichael , Based on the condition which you have mentioned. Below code would be ideal:-

Column C = IF('ZV Vertrieb'[Aboumsatz] <> BLANK(),'ZV Vertrieb'[Aboumsatz VJ])

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

WeihsMichael_1-1641821327024.png

I changed the code line, but the total remains unchanged 😞

@WeihsMichael , Can you try this now:-

Column C = IF('ZV Vertrieb'[Aboumsatz] <> BLANK(),'ZV Vertrieb'[Aboumsatz VJ],BLANK())

still if it is not working then is it possible for you to share your PBIX after removing sensitive data?

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Sorry, didn't work either. I´d love to share but editor has no such option to upload file, how can I share with you?

If you dont have any issue in sharing then you can share it through one drive or google drive.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Sure. What's you email, I can share via OneDrive.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.