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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
itiutiunnik
New Member

Wildcard vlookup

Hello,

 

I have 2 tables. First table contains applications and correpsonding error messages:

Table 1:

Application NameError message
Application 1Error occurred: Netork is not available. Please check Network connection.
Application 1Error: Service is down
Application 2Error: Service might be down.
Application 2Error occurred: Upstream service could not be contacted
Application 1Error occurred: Network service is not available
Application 3Error 500: Application encountered unknown error
Application 3Error 403: Forbidden. Access is not granted
Application 2Error occurred: Service is down

 

Second table contains error message pattarens (wildcard) and corresponding categories:

Table 2:

PatternCategory
Error*Network*not availableNetwork issue
Service*downService down
Application*errorApplication Error

 

I need resulting table that would match corresponding category to each error:

 

Table 3:

Application NameError messageCategory
Application 1Error occurred: Netork is not available. Please check Network connection.Network issue
Application 1Error: Service is downService down
Application 2Error: Service might be down.Service down
Application 2Error occurred: Upstream service could not be contactedUnknown
Application 1Error occurred: Network service is not availableNetwork issue
Application 3Error 500: Application encountered unknown errorApplication Error
Application 3Error 403: Forbidden. Access is not grantedUnknown
Application 2Error occurred: Service is downService down

 

Tried CONTAINSSTRING and MATCH and few other things but nothing seemed to work. Is it possible at all in DAX?

 

Would appreaciate any help. Thanks!

4 REPLIES 4
DataInsights
Super User
Super User

@itiutiunnik,

 

Try this calculated column in Table 1:

 

Category = 
VAR vErrMsg = Table1AppError[Error message]
VAR vResult =
    MAXX (
        Table2ErrorCat,
        VAR vPattern = Table2ErrorCat[Pattern]
        VAR vCategory = Table2ErrorCat[Category]
        VAR vStartPos =
            SEARCH ( vPattern, vErrMsg, 1, 0 )
        RETURN
            IF ( vStartPos <> 0, vCategory )
    )
RETURN
    IF ( ISBLANK ( vResult ), "Unknown", vResult )

 

DataInsights_0-1603206433856.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi im trying out this and hit an error at 

VAR vErrMsg = Table1AppError[Error message]



"A single value for column 'Column1' in table 'Sheet2' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."

@Anonymous,

 

Measures need an aggregate function (min, max, etc.). My solution is a calculated column, which has a row context (thus, no aggregate function is needed).





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

okay thank you @DataInsights 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.