How Can I Lookup Data In A Table When There Is Not A Match for Every Row?

whalensdad

New Member
Joined
Aug 18, 2015
Messages
2
I have a table called raw data with a column that contains a document number and an original document type. I have another table that lists a subset of the document numbers and identifies what type of document it really is (Let’s call it “Corrected_Document_Type”). This second table does not contain a row for every document number. I want to add a calculated field to the raw data table that would show the corrected document type from the second table when there is a match between the document numbers and the original document type when there is no match. I am using PowerPivot for Excel 2010 with PowerPivot 10.50.1600.1
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Using your existing table setup, to add a calculated column to RawData you could:
  1. Create a relationship from CorrectionTable[Doc Number] to RawData[Doc Number]. (This will work because RawData lists each document exactly once).
  2. The DAX to lookup the Corrected Document Type (in a calculated column in RawData) would be
    = CALCULATE( VALUES( CorrectionTable[Corrected Document Type] ) )
    This will return BLANK if the document isn't in CorrectionTable. I haven't worried about handling multiple matches in the CorrectionTable since I assume that wouldn't happen.
  3. I would confirm that this formula works, then wrap it in an IF function to use the corrected document type if it is not blank, otherwise use the original document type.
 
Upvote 0

Forum statistics

Threads
1,224,115
Messages
6,176,477
Members
452,728
Latest member
mihael546

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