Using VALUES with RELATEDTABLE

macfuller

Active Member
Joined
Apr 30, 2014
Messages
319
Office Version
  1. 365
Platform
  1. Windows
I have (simplified) 2 lookup tables (Requisitions and Departments) and a fact table (PurchaseOrders). I need to find who the requisitioners are for each department that created a PO for a particular vendor, with the Requesters field in the Requisitions table.

Requisitions is linked to orders by PO#_Line. Departments is linked via Dept field in each table.

Normally in my pivot table I would drag Requisition[Requester] to the measure and be done. It works for departments. But I'm getting all possible requisitioners for each department... the filters on the PurchaseOrders table aren't applying to the Requisition table. I suspect this is because the Requisition <-> PurchaseOrders relationship is 1:1.

So my next thought is to pull Requisition[Requester] into the PurchaseOrders table into a calculated column. But because the relationship is 1:1 I can't use =RELATED(Requisition[Requester]), I have to use RELATEDTABLE. And there's the question. If I wanted a numeric value I can use SUMX etc. and provide RELATEDTABLE(Requisition) as the table parameter. But since I want the text value of the requester I'm not sure how to tweak the DAX to pass RELATEDTABLE as a parameter in VALUES.

Since the tables are 1:1 related I'm not sure about the performance hit if I were to use PowerQuery to add the Requisitions columns to the PurchaseOrder table - the PO table is millions of rows and 30+ columns already.

Thanks for your suggestions!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Filters automatically flow from the lookup tables to the fact table -not the other way. So you can automatically filter requisitions using the departments and vice versa. But there is an easy solution using “black magic”.

Assuming there is only 1 person for each PO, this should work (a measure).

=calculate(if(hasonevalue(departments[requestor Name]),values(departments[requestor name])),PurchaseOrders)
 
Upvote 0
The measure builds properly but when I attempt to put it into my pivot table for <50 purchase orders already filtered Excel churns away for longer than I care to wait before hitting Escape<esc>.

With that kind of performance hit I'd rather find a way to populate a column with the related value - I shouldn't be held up by a 1:1 relationship?!</esc>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,094
Latest member
mystic19

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