SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Tabular using DAX: Possible to lookup across multiple tables (LOOKUPVALUE or CALCULATE?)


Tabular using DAX: Possible to lookup across multiple tables (LOOKUPVALUE or CALCULATE?)

Author
Message
Maxer
Maxer
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1892 Visits: 1624
I am working with some row filters and am having a heck of a time trying to lookup across multiple tables.



I need to return States[StateID] row in States where an Employee has a related CityID.

So States[StateID] to Cities[StateID] on Citites[CityID] to Employees[CityID] perhaps where Employees[Employee ID] is 3 or Employees[Login ID] = "Sam".

I can not seem to get this to work.

I can easily do Cities to Employees on Employee Login ID that isn't an issue:
LOOKUPVALUE(Employees[CityID],Employees[Login Id],"Sam",Employees[CityID],Cities[CityID])

it is Starting at State and moving through Cities to Employees that I just can't seem to do....
michael.buller
michael.buller
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 27
Can you be more specific about what you are trying to do here? If you were to add a pivot table to excel and took the Employee Name as a row value, then added the State as a slicer, when you click on a state, it would only show you the employees for that state. That is because of the filter context that would be passed in from Excel.
suhel
suhel
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 Visits: 55
You could pull through the StateID or StateName as a calculated column into the Employee table using the formula below. Then you should be able to filter as you need.

=RELATED(State[StateID])

Though I agree with the previous comment, that you havent provided enough context of the issue.

Thanks
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search