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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.