Forum Discussion
Report URL with Parameters in Teams notification
Hi team,
we have recently encountered an issue with Teams notification when we integrate Teams with PowerBI application. The issue is, the report link sent from Teams notification is not embedding the filters along with the link and making the report show incorrect data for the managers.
is there a way to embed the filter value in the teams notification
or
how do we filter for current logged in person when he comes from teams notification?
Some considerations/ background of the report are as below :
- This report is designed in such a way to show one persons data at a time.
- Users logs into this report from many different ways like
- from Powerapps
- from another powerbi report
- from another internal application
- In all these ways, we are embeded the report URL with parameters to filter for the logged in user
- The same report is used to view Team member's data as well by embedding a person's employee id which is done by using another button in the report which makes the manager log into the same report but filtering for another person in his team.
- The URL of the embeded report look something as below :
- app.powerbi.com/groups/..................../datasets/.................................../ReportSection............................&filter=table%2FEmpID%20eq%20%27"EmpID"%27
- the URL of the report link sent via teams notification is
- app.powerbi.com/groups/..................../datasets/................................... ---- This is no filtering happening here.
4 Replies
- Jonvoge
Most Valuable Professional
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- LP280388
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
- AnonymousNot 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.