# DAX Filter from multiple tables

#### losamfr17

##### Board Regular
Hi,

I don't understand why my measure won't work.
I have two mock tables which are not related. I want to use tbl_Sales as a base and create a measure that will return each person's goal for their respective month.

My measure is "Measure1 = CALCULATE( SUM( tbl_Goals[Goals] ) , FILTER( tbl_Goals, tbl_Goals[Month] = tbl_Sales[Month] && tbl_Goals[Name] = tbl_Sales[Name] ) )"
I get an error message with this measure even though I see it offered as a solution to similar questions.

#### Attachments

• 1600092816940.png
14.2 KB · Views: 3

### Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

#### Matt Allington

##### MrExcel MVP
This measure can never work under any circumstances. The filter function has a row context - in short the means you can refer to any columns in that table. But you are not allowed to refer to columns in the sales table the way you have because those columns are not part of the goals table. You CAN refer to the columns in the sales table as long as you wrap a function around those columns, such as MAX().

You don’t show how you are wanting to use the measure, but you could try this.
Measure1 = CALCULATE( SUM( tbl_Goals[Goals] ) , FILTER( tbl_Goals, tbl_Goals[Month] = MAX(tbl_Sales[Month]) && tbl_Goals[Name] = MAX(tbl_Sales[Name] ) ))

#### losamfr17

##### Board Regular
This measure can never work under any circumstances. The filter function has a row context - in short the means you can refer to any columns in that table. But you are not allowed to refer to columns in the sales table the way you have because those columns are not part of the goals table. You CAN refer to the columns in the sales table as long as you wrap a function around those columns, such as MAX().

You don’t show how you are wanting to use the measure, but you could try this.
Measure1 = CALCULATE( SUM( tbl_Goals[Goals] ) , FILTER( tbl_Goals, tbl_Goals[Month] = MAX(tbl_Sales[Month]) && tbl_Goals[Name] = MAX(tbl_Sales[Name] ) ))

Wow thank you so much for taking the time to respond. Gd bless you.

Replies
2
Views
164
Replies
1
Views
115
Replies
1
Views
90
Replies
0
Views
72
Replies
1
Views
196