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
AH2022
Helper II
Helper II

Power BI Dax to SUM based on two other columns condition

Hi All,

 

I have the 2 tables shown below.
I need a DAX measure to calculate the balance, within the GiftSplit Table. (Balance = Pledge - PledgePayments)

AH2022_0-1660694954972.png

 


I calculate:
SUMPledgeGiftSplit = calculate(SUM(RE_GiftSplit[amount]),RE_Gift[type]="Pledge")
SUMPledgePaymentGiftSplit = calculate(SUM(RE_GiftSplit[amount]),RE_Gift[type]="PledgePayment")
It doesn't work because GiftSplit[gift_id]=121 to 125 and the payments are on PledgePayment for which Gift[ linkedgift_id] 12=Gift[id] 12.

 

I tried : 

 

PledgePaymentsGiftSplit =
VAR IDNO = SELECTEDVALUE(Gift[id])
RETURN
SUMX(FILTER(ALL(Gift),Gift[linkedgift_Id] = IDNO), GiftSplit[amount])

 

And I get this message : A single value for column 'amount' in table 'GiftSplit' cannot be determined.

I tried related and it doesn't work.

 

What am I doing Wrong? Thank You!

1 ACCEPTED SOLUTION

Thank you very much for the answer @amitchandak The requirements have been changed. Good Day.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@AH2022 , the first one is correct the second one need to me

 

calculate(SUM(RE_GiftSplit[amount]),filter( allselected(RE_Gift), RE_Gift[RE_Gift] =max(RE_Gift[Gift_id]) && [ID] <= Max([ID]) &&   RE_Gift[type]="PledgePayment") )

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

Thank you very much for the answer @amitchandak The requirements have been changed. Good Day.

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.