DAX Filter from multiple tables

losamfr17

Board Regular
Joined
Jun 10, 2016
Messages
149
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.

Could anyone please advise?

1600092895132.png
 

Attachments

  • 1600092816940.png
    1600092816940.png
    14.2 KB · Views: 10

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
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] ) ))
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,254
Members
448,879
Latest member
oksanana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top