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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bdd9
Frequent Visitor

DAX calculate formula with filters...I'm Confused

I have successfully written a formula that returns sales quantity from my fact table. the filters in the formula work even though my fact table (NS_Transactions) DOES NOT have a relationship with my dimension item table (NS_Items). However, when I create the relationship between the 2 tables, the formula breaks and returns nothing.  

 

Why would the filters and the formula work BEFORE there is even a relationship but not AFTER?

 

Here is the formula:

 

SalesQty_m = CALCULATE(

-sum(NS_Transactions[Qty]),

filter(NS_ITEMS,NS_ITEMS[TYPE_NAME]="Inventory Item"),

FILTER(NS_Accounts,NS_Accounts[TYPE_NAME]="Income")

)

 

Here is the accurate results BEFORE I create the relationship:

before.JPG

HEre is blank result I get after:

after.JPG

Here is a screenshot of the the relationship

relationship.JPG

1 ACCEPTED SOLUTION
bdd9
Frequent Visitor

Mystery solved...

The formula works perfectly...

The problem was I passed incorrect Type_Name in the filter for the item. Hence, the reason I was getting correct results without the item relationship was because that filter was not working anyway. In essence I didn;t need that filter to get the correct result AND I was using an incorrect parameter in the filter

 

Once I corrected that issue, I get the desired result

 

Thanks for your help and patience

View solution in original post

3 REPLIES 3
prateekraina
Memorable Member
Memorable Member

Hi @bdd9,

 

Check relationship with NS_Accounts table. 

 

 

Prateek Raina

Thank you for replying and offering help 🙂

A relationship does exist. 

I double checked the relationship between ns_transactions and ns_accounts. Here is a screenshot of it:

relationshipaccts.JPG

bdd9
Frequent Visitor

Mystery solved...

The formula works perfectly...

The problem was I passed incorrect Type_Name in the filter for the item. Hence, the reason I was getting correct results without the item relationship was because that filter was not working anyway. In essence I didn;t need that filter to get the correct result AND I was using an incorrect parameter in the filter

 

Once I corrected that issue, I get the desired result

 

Thanks for your help and patience

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