cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EnrichedUser
Helper II
Helper II

Measure: Find Partial Text in Unrelated Table

Hi,

 

I have two unreleated tables with 1 common field.

My goal is to create a measure that can identify, for any given SalesOrderID, if there exists a partial match for "Order added to warehouse" in another table's "Message" column. 

 

Table1: ApplicationAudit

BranchIDApplicationIDTransactionNumberMessageModAtAutoID
SF01SALESORDER1118778Order added to warehouse order 00035991.12/30/2020 8:5117898821
SF01SALESORDER1056768Order added to warehouse order 00036431.1/8/2021 14:1818141984
SF01SALESORDER1118781Order added to warehouse order 00037859.2/4/2021 14:4018944137
DADFSALESORDER1118628Order added to warehouse order 00036097.1/4/2021 10:1417958991
DADFSALESORDER1118628To Bin: SHIP011/4/2021 13:3217970590

 

Table2:SalesOrder

BranchIDSalesOrderID
RK101123590
DADF1123552
SF011056768
SF011118778
DADF1118628

 

Expected Output (messure):

BranchIDSalesOrderIDAdded to warehouse
RK101123590NO
DADF1123552NO
SF011056768YES
SF011118778YES
DADF1118628YES

 

Notes:

 

Both tables have additional fields but ApplicationAudit.TransactionNumber = SalesOrder.SalesOrderID

 

SalesOrderIDs 1056768, 1118778 and 1118628 have "Yes" under "Added to warehouse" because in the applicationaduit table, the same TransacationNumber has a log under the message column for "Order added to warehouse"


SalesOrderID and TransactionNumber have duplicates in each table

 

Added to warehouse =
IF(ISBLANK(
MINX(
FILTER(ApplicationAudit, SEARCH("Order added",ApplicationAudit[Message],1,0) > 0 ),
SalesOrders[Lines])),
"YES",
"NO")
1 ACCEPTED SOLUTION

@EnrichedUser , Try some thing like 

 

if(isblank(countx(filter(ApplicationAudit,SalesOrder[SalesOrderID] = ApplicationAudit[TransactionNumber] && search("Order added to warehouse", ApplicationAudit[Message],,0) >0),ApplicationAudit[Message])), "No", "Yes")



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@EnrichedUser , Try a new column in SalesOrder

 

if(isblank(countx(filter(ApplicationAudit,search(SalesOrder[SalesOrderID], ApplicationAudit[Message],,0) >0),ApplicationAudit[Message])), "No", "Yes")



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Hi @amitchandak 

Thank you for your quick reply. Unfortuntaly, this was not able to resolve.

looking at your dax:
if(isblank(countx(filter(ApplicationAudit,search(SalesOrder[SalesOrderID], ApplicationAudit[Message],,0) >0),ApplicationAudit[Message])), "No", "Yes")

it does not take into account the message field for "Order added to warehouse"

 

Also, SalesOrderID would not be in Message but TranscationNumber

@EnrichedUser , Try some thing like 

 

if(isblank(countx(filter(ApplicationAudit,SalesOrder[SalesOrderID] = ApplicationAudit[TransactionNumber] && search("Order added to warehouse", ApplicationAudit[Message],,0) >0),ApplicationAudit[Message])), "No", "Yes")



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Dev Camp Session 26

Check it Out!

Mark your calendars and join us on Thursday, September 29 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors