DAX Filter from multiple tables

losamfr17

Board Regular
Joined
Jun 10, 2016
Messages
144
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: 3

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Matt Allington

MrExcel MVP
Joined
Dec 18, 2014
Messages
1,239
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
Joined
Jun 10, 2016
Messages
144
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,114,109
Messages
5,545,991
Members
410,718
Latest member
ALM1GHTY
Top