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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Matt Allington

MrExcel MVP
Joined
Dec 18, 2014
Messages
1,236
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,109,411
Messages
5,528,621
Members
409,828
Latest member
99DodgeRam

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top