Forum Discussion

shreyasr's avatar
shreyasr
Frequent Visitor
3 years ago

Power BI Filter data based on user based on Azure AD attribute

I have a requirement to filter data in power BI based on user .

So when a user logs in Power BI desktop

  1. Can we trigger Power BI query on user login to call Microsoft Graph API to get user attributes
  2. once we have this data , we filter data based on the attributes .

So in short , Can i trigger a graph api call on power BI login and filter data based on response .

Thanks,

Shreyas

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi shreyasr ,

     

    Yes, it is possible to trigger a Graph API call on Power BI login to get user attributes and filter data based on the response. You can use the Power Query SDK to create a custom data connector that calls the Graph API and retrieves the user attributes. Then, you can use row-level security (RLS) to filter the data based on the user attributes. RLS is a feature that allows a dataset owner to restrict access to the data for the users consuming it. This is done via roles, that users are assigned to. Each role is basically a DAX expression, and there's 2 types of such roles/expressions: regular/static RLS, where the same filter is applied to all users in that role, and dynamic RLS, where the filtering condition uses the username() or the userprincipalname() functions. Those functions resolve to the domain name / UPN of the user visualizing the data, which means that the filtering condition will be different for each user.

     

     

     

                                                                                                                                                             

    Best Regards,

    Stephen Tao

     

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