What value is returned when RELATED finds no match?

macfuller

Active Member
Joined
Apr 30, 2014
Messages
319
Office Version
  1. 365
Platform
  1. Windows
I must have fallen asleep in DAX 101, but I have a tough time testing for RELATED() values that aren't there.

Example: We order products that may be substituted by our vendor. We subsequently have to revise our PO to change from the vendor item ID in our item master to the one provided by our vendor. We retain our internal PeopleSoft number "PS ID" regardless of the item. Not all orders ("scripted") have PeopleSoft numbers/items in our item master however. Therefore I would like to return 3 values into a "Sub" column of our Orders table:

"Scripted" - no matching value found in our item master.
"Sub" = Orders[Vendor ID] <> RELATED('Item Master'[Supplier ID']
"Base" = Orders[Vendor ID] = RELATED('Item Master'[Supplier ID']

the item master table has a relationship via the [PS ID] field to the Orders table.

I'm not clear on whether I test for BLANK() or null string for the Scripted response, or if I have to do a FILTER statement somewhere.
 
Last edited:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hello, the RELATED() function returns BLANK() if there is no matching row in the parent table. You can test for it using the ISBLANK() function.
 
Upvote 0
That doesn't work for me. It doesn't trap for the error.
=ISBLANK(RELATED('Item Master'[Vendor Item ID])) returns FALSE for items I know are missing in the lookup table.

=RELATED('Item Master'[Vendor Item ID]) = "" also returns FALSE

I don't know what type of value is being returned
 
Upvote 0
That doesn't work for me. It doesn't trap for the error.
=ISBLANK(RELATED('Item Master'[Vendor Item ID])) returns FALSE for items I know are missing in the lookup table.

=RELATED('Item Master'[Vendor Item ID]) = "" also returns FALSE

I don't know what type of value is being returned

Related returns a blank when the lookup value is not found . how ever to check the blank use the next column with ISBLANK & not the same column in which related also resides.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,212
Members
453,023
Latest member
alabaz

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