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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Lindino08
Frequent Visitor

Dax formula output breaks when filtering on multiple tables

I am creating a new column to calculate the weighted average price for our products based on multiple filters.

I am getting what looks like a proper output when using this DAX formula. 

2022 Price List Weighted average Dealer Price Column 2 = CALCULATE(DIVIDE(SUMX('quotedetail',[Dealer Price Per Unit]*[Quantity]),SUMX('quotedetail',[Quantity])),
FILTER(ALLSELECTED('quote'), quote[Price List] = "2022 Price List"),
FILTER(ALLSELECTED('quote'), quote[statuscodename] <> "Revised"))

Lindino08_0-1675453391699.png

 

But as soon as I add in one more filter from my Quotedetails table the amounts are all the same.

2022 Price List Weighted average Dealer Price Column 2 = CALCULATE(DIVIDE(SUMX('quotedetail',[Dealer Price Per Unit]*[Quantity]),SUMX('quotedetail',[Quantity])),
FILTER(ALLSELECTED('quote'), quote[Price List] = "2022 Price List"),
FILTER(ALLSELECTED('quote'), quote[statuscodename] <> "Revised"),
FILTER(ALLSELECTED('quotedetail'), quotedetail[Option Upcharge?] = "No"))
Lindino08_1-1675453580038.png

 

Any help with this is greatly appreciated!

 

1 REPLY 1
amitchandak
Super User
Super User

@Lindino08 , Use allselected , if you want to ignore some filter. Try like

 

2022 Price List Weighted average Dealer Price Column 2 = CALCULATE(DIVIDE(SUMX('quotedetail',[Dealer Price Per Unit]*[Quantity]),SUMX('quotedetail',[Quantity])),
FILTER(ALLSELECTED('quote'), quote[Price List] = "2022 Price List"),
FILTER(ALLSELECTED('quote'), quote[statuscodename] <> "Revised"),
FILTER(('quotedetail'), quotedetail[Option Upcharge?] = "No"))

 

or

 


2022 Price List Weighted average Dealer Price Column 2 = CALCULATE(DIVIDE(SUMX('quotedetail',[Dealer Price Per Unit]*[Quantity]),SUMX('quotedetail',[Quantity])),
FILTER(('quote'), quote[Price List] = "2022 Price List" && quote[statuscodename] <> "Revised"),
FILTER(('quotedetail'), quotedetail[Option Upcharge?] = "No"))

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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