Forum Discussion
Report URL with Parameters in Teams notification
Hi LP280388
I believe the correct solution to this is not URL Parameters, but rather Row Level Security.
As your users are logged in when they access the report in both Teams and Power BI Service, we can in Power BI return their User ID with the DAX formula USERPRINCIPALNAME() - Or just USERNAME() if you want it without the email suffix.
You can use this in a Security Rule, in which you filter your [EMP ID] by the USERPRINCIPALNAME() to dynamically filter your report based on the user logged in.
Here's a good guide: Dynamic Row Level Security with Power BI Made Simple - RADACAD
_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
Find me on LinkedIn, Sessionize, or my blog Downhill Data
- LP2803881 year ago
Resolver II
Jonvoge , thanks for responding. Yes it is indeed the RLS which is filtering for Manager and his directs too in the same report. Since we can duplicate the same report to seperate the managers and his directs we are leveraging one report and parameters to filter the data.
Is there a possibility to do the below :
1. when a user logs into the report - "without URL parameters " then it should filter for himself.
2. When the user logs into the report - "with URL parameters" then it should filter for the person embedded in the url
- Anonymous1 year agoNot applicable
Hi LP280388
Here's an idea for your reference:
First of all, create roles in Power BI Desktop that define the filtering logic. For example:
[EmpID] = IF( ISFILTERED('YourTable'[EmpID]) && SELECTEDVALUE('YourTable'[EmpID]) <> BLANK(), SELECTEDVALUE('YourTable'[EmpID]), USERPRINCIPALNAME() )Then set up url parameters, and ensure that the URLs sent in Teams notifications include the necessary parameters to filter the data. For example:
app.powerbi.com/groups/.../datasets/.../ReportSection?filter=YourTable/EmpID eq 'PARAM_EMP_ID'Next, handle filtering in Power BI, use DAX to detect whether a URL parameter is present. You can create a calculated column or measure to check if the EmpID filter is applied.
FilteredEmpID = IF( ISFILTERED('YourTable'[EmpID]), SELECTEDVALUE('YourTable'[EmpID]), USERPRINCIPALNAME() )When setting up the Teams notification, ensure the URL includes the filter parameter if you want to filter for another user. If no parameter is included, the RLS will apply and filter for the logged-in user.
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- LP2803881 year ago
Resolver II
Anonymous , I get the error that userprinciple cant be used in calculated column for the below. If i create a measure, im unable to use it in the "Filter all page". Is there any other way ?
Since i have multiple visuals in the canvas and multiple pages of same showing other info of the same employee, I have to apply this filter at "Filter on all pages"FilteredEmpID = IF( ISFILTERED('YourTable'[EmpID]), SELECTEDVALUE('YourTable'[EmpID]), USERPRINCIPALNAME() )Thanks for your reply.