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

View all the Fabric Data Days sessions on demand. View schedule

Reply
ekepp
New Member

Help: Calculated column only considering half of filter condition

Hello, I'm having trouble with a DAX expression. I have two tables, Vendors and Receipts . They're laid out like so, with a many-to-many relationship linked through the Vendor column:

Vendors:

MonthVendor
2022-01AlphaAssociates
2022-02AlphaAssociates
2022-01BuenoBiz
2022-02

BuenoBiz

2022-01CenturyComm
2022-02CenturyComm

 

Receipts: 

MonthVendorCost
2022-01AlphaAssociates$10
2022-01AlphaAssociates$5
2022-01BuenoBiz$5
2022-01CenturyComm$7
2022-02AlphaAssociates$15
2022-02BuenoBiz$9
2022-02CenturyComm$3

 

I'm trying to add a calculated column to the Vendors table that sums the data in Receipts according to the Month and Vendor of the row. Right now I'm using the expression 

Total Cost = CALCULATE( Sum('Receipts'[Cost]), FILTER('Receipts',Receipts[Vendor] = [Vendor] && Receipts[Month] = [Month]))
 
I expect my Vendors table to look like:
MonthVendorCost
2022-01AlphaAssociates$15
2022-02AlphaAssociates$15
2022-01BuenoBiz$5
2022-02

BuenoBiz

$9

2022-01CenturyComm$7
2022-02CenturyComm$3
 
But instead I get all matching vendors summed, regardless of month:
MonthVendorCost
2022-01AlphaAssociates$30
2022-02AlphaAssociates$30
2022-01BuenoBiz$14
2022-02

BuenoBiz

$14

2022-01CenturyComm$10
2022-02CenturyComm$10
 
What am I missing here? Or is this not feasible without a helper column of "Month&Vendor"?
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ekepp , I tried a new column and getting the correct result

Column = sumx(FILTER(Receipts, Receipts[Month] = Vendors[Month] && Receipts[Vendor] = Vendors[Vendor]),Receipts[Cost])

 

amitchandak_0-1677550648514.png

 

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

View solution in original post

2 REPLIES 2
ekepp
New Member

I guess I should have been using SUMX instead of CALCULATE and SUM, thank you!

amitchandak
Super User
Super User

@ekepp , I tried a new column and getting the correct result

Column = sumx(FILTER(Receipts, Receipts[Month] = Vendors[Month] && Receipts[Vendor] = Vendors[Vendor]),Receipts[Cost])

 

amitchandak_0-1677550648514.png

 

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

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.