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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
CvanP
Regular Visitor

Use selection to filter table, use associated result to filter separate table visual

Hi there,

I got the following data:

authorisation_idrole_ididentity_id
110021
110022
1 3
1 4
1 5
210033
210034
310045
410051
410052
410053
410054
410055
410056
410057

 

Now I want to do the following:

  1. Select an authorisation_id, for example: 2
  2. Take the resulting identity_id's: 3 & 4
  3. Show a table of all the roles these identity_id's (3 & 4) have, so in this case role_id's: 1003 and 1005

The problem I am running into, is that when I select an authorisation_id in a table in my report, it automatically filters role_id as well. I know I can prevent this by going to format -> edit interactions -> None on my role_id table visual. But this gives me all the role_id's, even the ones not associated with the identity_id's that have the selected authorisation_id. I tried solving this with some dax with calculated measures/columns so it gives a TRUE/FALSE based on if the role_id has one of the selected identity_id's, but I just can't make sense of it and neither can CoPilot etc.

So I am looking for a way to answer this question:
How can I show all the role_id's associated with the identity_id's that have the current selected authorisation_id.

Any help is appreciated and if you need any more info please let me know.

1 ACCEPTED SOLUTION
CvanP
Regular Visitor

Thanks for the help everyone.

In the end I solved it the following way:

  1. Made a copy of my table using DAX:
    CopyDemoData =
    DemoData
  2. Kept this new table CopyDemoData separate from DemoData (so no relationships)
  3. Added DAX:

    CountSelectedUsers =
    VAR __selectedUsers = VALUES(DemoData[identity_id])
    RETURN
    COUNTROWS(__selectedUsers)

    SelectedUsers =
    VAR __selectedUsers = VALUES(DemoData[identity_id])
    RETURN
    CONCATENATEX(DemoData,DemoData[identity_id], ",")

    IdentitiesInRole =
    CONCATENATEX(VALUES('Table'[identity_id]), 'Table'[identity_id], ",")

    CompareValues =
    IF(
        COUNTROWS(
            INTERSECT(
                VALUES(DemoData[identity_id]),
                VALUES('Table'[identity_id])
            )
        ) > 0,
        "Found",
        "Not Found"
    )
    CountCompareValues =
        COUNTROWS(
            INTERSECT(
                VALUES(DemoData[identity_id]),
                VALUES('Table'[identity_id])
            )
        )
     
  4. Filtered based on CompareValues
  5. Celebrated 

View solution in original post

3 REPLIES 3
CvanP
Regular Visitor

Thanks for the help everyone.

In the end I solved it the following way:

  1. Made a copy of my table using DAX:
    CopyDemoData =
    DemoData
  2. Kept this new table CopyDemoData separate from DemoData (so no relationships)
  3. Added DAX:

    CountSelectedUsers =
    VAR __selectedUsers = VALUES(DemoData[identity_id])
    RETURN
    COUNTROWS(__selectedUsers)

    SelectedUsers =
    VAR __selectedUsers = VALUES(DemoData[identity_id])
    RETURN
    CONCATENATEX(DemoData,DemoData[identity_id], ",")

    IdentitiesInRole =
    CONCATENATEX(VALUES('Table'[identity_id]), 'Table'[identity_id], ",")

    CompareValues =
    IF(
        COUNTROWS(
            INTERSECT(
                VALUES(DemoData[identity_id]),
                VALUES('Table'[identity_id])
            )
        ) > 0,
        "Found",
        "Not Found"
    )
    CountCompareValues =
        COUNTROWS(
            INTERSECT(
                VALUES(DemoData[identity_id]),
                VALUES('Table'[identity_id])
            )
        )
     
  4. Filtered based on CompareValues
  5. Celebrated 
Ashish_Mathur
Super User
Super User

Hi,

I have solved a similar question in the attached file.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
parry2k
Super User
Super User

@CvanP check this video on my channel that talks about something similar, tweak the solution as you see fit.

 

https://www.youtube.com/watch?v=zS1IDl3DLak&feature=youtu.be



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.