Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
In DAX, I am trying to subtract one measure from another , lets say A-B and I wrote a condition (If A>B, A-B, 0). I am not able to get the total of this measure.
I am trying to subtract two measures, A-B with a condition that if it is negative value then it should be 0. I am not able to get the total value
hi, @Anonymous
It is a measure totals problem. Very common.
here is a post for you to reference:
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
IF not your case, Please share some data sample and the formula and expected output. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading
Best Regards,
Lin
If you want the total to work correclty then you should do a SUMX (assuming you looking for sum):
Final Measure = SUMX ( VALUES ( Table[Dimension Used in your table] ), VAR a = [A] VAR b = [B] RETURN IF ( a > b, a - b, 0 ) )
User | Count |
---|---|
97 | |
73 | |
69 | |
43 | |
23 |