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
Power007
Frequent Visitor

How to Calculate SUM of values that meets a condition and more ...

Hello Power BI gurus,

I am struggling with a few things here. And I have to admit I'm also struggling with how to describe the scenario.  Anyway, partial list of the data I'm working on is attached below. Also, the desired output (Matrix) is also attached below. (Please note that the numbers represent the entire data, and not just a subset.)

1) I need a Measure to Calculate Prior Budget.  It should be a sum of all values where BT Class 2 - "PRIORB"

2) I need a Measure to Calculate Ending Budget.  It should be Prior Budget minus Net Debit minus Net Credit.

3) Why is Total for Net Debit and Net Credit incorrect?

 

Here are the DAX used:

Net Credit = IF(Sum('X_GL_TRANSACTION_DETAIL'[Debit]) < Sum('X_GL_TRANSACTION_DETAIL'[Credit]), Calculate (Sum('X_GL_TRANSACTION_DETAIL'[Credit])) - Calculate (Sum('X_GL_TRANSACTION_DETAIL'[Debit])), Blank())
 
Net Debit = IF (Sum('X_GL_TRANSACTION_DETAIL'[Debit]) < Sum('X_GL_TRANSACTION_DETAIL'[Credit]), Blank(),Calculate (Sum('X_GL_TRANSACTION_DETAIL'[Debit])) - Calculate (Sum('X_GL_TRANSACTION_DETAIL'[Credit])))
 
Thank you very much.
 

 

 

Power007_2-1670749785049.png

 

 

Power007_1-1670749418529.png

 

 

 

 

 

 

5 REPLIES 5
v-jialluo-msft
Community Support
Community Support

Hi  @Power007 ,

 

You can try this:

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

Best Regards,
Gallen Luo

Hi Gallen,

Here's the link to the sample data and desired output.

https://we.tl/t-5HvKMWAC4O

Thank you,

Carlito

 

v-jialluo-msft
Community Support
Community Support

Hi  @Power007 ,

 

According to your description, you need to do some measurement operations.

You may need to use the ALL function to remove filtering of the data, please provide sample data and expected output to further solve the question.

 

Best Regards,
Gallen Luo

Thank you for looking into this.  My problem is I don't know how to attach sample data file here.

Please advise.

 

 

 

Power007
Frequent Visitor

Correction:

2) Ending Budget = Prior Budget plus Net Debit minus Net Credit

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
Top Kudoed Authors