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
Anonymous
Not applicable

Search is not behaving

I could have the simplest of solutions if I could get the SEARCH function to work (as it does in a slicer-search or with the Text Search Visual, in a calculated column or measure. My scenario is that I need to look at multiple columns based off of a single slicer-selection. I need the slicer text to look across the row at both manager columns and tell me if it finds the text. Can't get this one to work.. any thoughts?

 

Thank you

pic.png

 

2 ACCEPTED SOLUTIONS
mahoneypat
Employee
Employee

You can try this measure expression to return a 1 when one of the manager columns matches your slicer value.  I assume your slicer values are in a disconnected table.  Replace Slicer and Table with your actual table names.

 

 

IsMatch =
VAR slicer =
    SELECTEDVALUE ( Slicer[Manager] )
RETURN
    IF (
        NOT (
            ISBLANK (
                COUNTROWS (
                    FILTER (
                        ALLSELECTED ( Table ),
                        Table[Manager1] = slicer
                            || Table[Manager2] = slicer
                    )
                )
            )
        ),
        1
    )

 

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

v-yingjl
Community Support
Community Support

Hi @Anonymous ,

Search() function is used to return the number of the starting position of the first text string from the first character of the second text string. It will not be applied in this issue.

You can try to create a measure like this:

Result = 
var _managers = SELECTEDVALUE(Managers[Managers])
var _manager1 = SELECTEDVALUE('Table'[manager1])
var _manager2 = SELECTEDVALUE('Table'[manager2])
return
IF(
    HASONEFILTER(Managers[Managers]),
    IF(
        _managers = _manager1 || _managers = _manager2,
        "yes",
        "no"
    ),
    "error"
)

before slicerbefore slicerafter slicerafter slicer

Attached a sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly. Thanks!


Best Regards,
Yingjie Li

v-yingjl
Community Support
Community Support

Hi @Anonymous ,

Search() function is used to return the number of the starting position of the first text string from the first character of the second text string. It will not be applied in this issue.

You can try to create a measure like this:

Result = 
var _managers = SELECTEDVALUE(Managers[Managers])
var _manager1 = SELECTEDVALUE('Table'[manager1])
var _manager2 = SELECTEDVALUE('Table'[manager2])
return
IF(
    HASONEFILTER(Managers[Managers]),
    IF(
        _managers = _manager1 || _managers = _manager2,
        "yes",
        "no"
    ),
    "error"
)

before slicerbefore slicerafter slicerafter slicer

Attached a sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

mahoneypat
Employee
Employee

You can try this measure expression to return a 1 when one of the manager columns matches your slicer value.  I assume your slicer values are in a disconnected table.  Replace Slicer and Table with your actual table names.

 

 

IsMatch =
VAR slicer =
    SELECTEDVALUE ( Slicer[Manager] )
RETURN
    IF (
        NOT (
            ISBLANK (
                COUNTROWS (
                    FILTER (
                        ALLSELECTED ( Table ),
                        Table[Manager1] = slicer
                            || Table[Manager2] = slicer
                    )
                )
            )
        ),
        1
    )

 

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Thank you for the suggestion. I'll give this a try and get back to this post with results. 
@mahoneypat @v-yingjl 

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.