Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
EnrichedUser
Helper III
Helper III

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")

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")

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")

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors