Forum Discussion

puru85's avatar
puru85
Helper II
2 years ago
Solved

Dynamic URL Filtering for Phone Numbers in Power BI URL

Hi Experts,

I have a Customer Dashboard in Power BI that has been published to the Power BI Service. This dashboard includes customer phone numbers and details about their purchases.

Context:
When I receive a call from a customer via Microsoft Teams, I want to link this information to Microsoft Teams using a URL. For example: http://Customerdashboardurl.com/#[phone number]. When this URL is updated with a different phone number, the destination will show different contents based on the matched phone number.

The following is sample data.



Current Approach: For now, the dashboard uses basic filtering with URLs like this:
https://app.powerbi.com/groups/me/reports/26d5425d-da53-4ab1-a7c1-d7509fed0dd9/a772bbf4995425b63827?filter=FamilyMembersTable/PhoneNumbers eq '6061258722'

 


This method effectively filters the dashboard to show data for phone numbers that exactly match ‘6061258722’.

Requirement:
I need to implement advanced filtering where the phone numbers contain ‘9055570868’ rather than an exact match. 

The Reason behind implementing advanced filtering in URL Filter is to identify not just the primary customer but potentially any family or associated members linked via similar phone numbers.

Below is the expected outcome of advanced filtering in URL Filter for Phone number ‘9055570868’.





Attached is the PBIX: 

CustomerDashboard.pbix


Could anyone guide me on how to achieve this advanced filtering in Power BI URL ? Any help or suggestions would be greatly appreciated!

Thank you!

 

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi puru85 

     

    You can try to create a separate phone table as a slicer, and set a filter in your table visual, associated with the slicer by the “CONTAINSSTRING” DAX function. 

    Here are the detailed steps, hope it can meet your requirement.

    1. Create a separate phone table and then create a slicer with "PhoneNumberFilter" field. ("phone" type:Text)

     

    PhoneFilterTable = SELECTCOLUMNS(
        DISTINCT(Customer_FK[Phone]),
        "PhoneNumberFilter", Customer_FK[Phone]
    )

     

    2. Create a new measure with the following DAX:

     

    FilteredRows = 
    IF(
        CONTAINSSTRING(SELECTEDVALUE(FamilyMembersTable[PhoneNumbers]), SELECTEDVALUE(PhoneFilterTable[PhoneNumberFilter])),
        1, 
        0)

     

    3. Drag "PhoneNumbers" field into the table visual and then drag “FilteredRows” into the Filter panel of the table visual and set the condition to is 1.

    4. Publish to Power BI Service and test.

    example URL: https://app.powerbi.com/groups/{groups_id}/reports/{report_id}?filter=PhoneFilterTable/PhoneNumberFilter eq '4329159883'

     

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

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi puru85 

     

    You can try to create a separate phone table as a slicer, and set a filter in your table visual, associated with the slicer by the “CONTAINSSTRING” DAX function. 

    Here are the detailed steps, hope it can meet your requirement.

    1. Create a separate phone table and then create a slicer with "PhoneNumberFilter" field. ("phone" type:Text)

     

    PhoneFilterTable = SELECTCOLUMNS(
        DISTINCT(Customer_FK[Phone]),
        "PhoneNumberFilter", Customer_FK[Phone]
    )

     

    2. Create a new measure with the following DAX:

     

    FilteredRows = 
    IF(
        CONTAINSSTRING(SELECTEDVALUE(FamilyMembersTable[PhoneNumbers]), SELECTEDVALUE(PhoneFilterTable[PhoneNumberFilter])),
        1, 
        0)

     

    3. Drag "PhoneNumbers" field into the table visual and then drag “FilteredRows” into the Filter panel of the table visual and set the condition to is 1.

    4. Publish to Power BI Service and test.

    example URL: https://app.powerbi.com/groups/{groups_id}/reports/{report_id}?filter=PhoneFilterTable/PhoneNumberFilter eq '4329159883'

     

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

     

  • Hi Anonymous ,

    Thank you so much for great help!, Could I request you to share your working Customer dashboard.pbix.


    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi puru85 

      Of course, please refer to the uploaded attachment.

       

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