The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
We have been facing an issue with Teams notification sending direct links to users without parameter that are needed to filter the data for the users.
Would like to check if there is an option to check if there is a parameter in the URL or not.
The report scenario is, we have an employee report where the data gets filtered for User and his/her direct reportees through RLS. However, the report is designed in such a way to show one user information at any point of time. Hence, we use URL parameter to filter for one user.
For example, we have a report which has like 100 records. A is a manager and has x, y and z has his direct reportees.
when A logs in to the report with is Employee ID in the parameter "filter=table[employeeid]='A' " , it filters for A's related data. Like wise if A add a parameter value "z" ( "filter=table[employeeid]='c' ") then he can see z's related data only.
Think of this report as a Profile page you see for any users in any application where it shows one person's data a time.
RLS wont allow A to see Manager B or B's direct reportess data. this is perfectly working fine.
Recently the microsoft introduced an update to Teams and its sending direct links to the users without any parameter( "filter=table[employeeid]='A' ") . This is causing confusion for users, in our example "A" when he goes to the report, it shows him, his data and also x,y,z's data as well.
is there a way to avoid this and say, if there is no report url then show only A's data. else, take the value from parameter ?
I have already tried isfiltered() measure. this I cant use it in the page level/report level filter. and using it at visual level is impacting the performance of the report.
Hi @LP280388, could you elaborate more on how you're sending messages to employees and the recent Teams update you've mentioned? How did you construct URL, what is a trigger to send it out to employees, what tool do you use to send and etc.
@Sergii24 , the URL is not constructed by us. Its triggering from Teams application automatically. It shows up in the Activity tab of Teams application. The message to the user read as "check out the report your colleague has viewed recently... blah blah blah... " .
This triggering of notification is due to some update Microsoft patched recently to the Teams application (Microsoft confirmed that). There is no pattern on how, to whom, when these notifications are sent.
Either we have to figure out how this can be solved at the PowerBI level.
Or how to stop the teams notification. stopping the teams notification is not possible as it has to be done for the entire org.
You might consider using Power Automate to send correct messages via Teams. At the same time you'll need to provide a guidance to users to ignore or turn off notifications from Power BI in Teams to avoid turning it off for entire organization.
@Sergii24 Could you please guide how Power automate flow can be created for these teams notification?
These notifications are randomly getting triggered to the users of the report.
To use Power Automate flow, you'd first need to identify and capture a trigger. What is the trigger for notifications to be sent out now? Is it a semantic model refresh? Change of a value for a specific KPI greater than a threshold?
Once you have a trigger, let's define what users should receive. Do you want to send the same link to the report to multiple users? Do you want prefilter it for each of them/group of them in a specific manner?
Turning off notification from PowerBI at the user level is not possible as this report is open for everyone in the organisation. As i said, this report is kind of Profile screen so its available for everyone.
We can putup a message on the report to ignore. However, the client is not approving to take this as a solution or even as a temp solution.
Could you please elaborate more on creating a Power Automate flow?
Hi @LP280388 ,
To address the issue of Teams notifications sending Power BI report links without the required filter parameters, which causes users to see unintended data, you can enforce a default filter behavior when the URL parameter is missing. The goal is to ensure that the report always filters to the logged-in user’s data if no URL parameter is provided, while still allowing the URL parameter to override this default behavior when present.
A suitable approach is to create a dynamic DAX measure that checks whether the report is being filtered by an Employee ID parameter in the URL. You can achieve this by using the following DAX measure:
UserFilterCheck =
IF(
ISFILTERED('Employee'[EmployeeID]),
MAX('Employee'[EmployeeID]),
USERPRINCIPALNAME()
)
This measure first checks if the EmployeeID column is being filtered. If it is, it returns the filtered Employee ID from the parameter. If no parameter is detected, it defaults to the logged-in user's identity using the USERPRINCIPALNAME() function.
Next, apply this measure as a page-level filter in Power BI. Navigate to the report's page in the Power BI Desktop or Service, then drag the UserFilterCheck measure to the Filters pane and set the filter condition to “is not blank.” This ensures that the report shows only the logged-in user’s data when no parameter is passed through the URL.
If you want to implement more granular control at the visual level, create a similar DAX measure for validation:
ValidatedEmployeeID =
IF(
ISFILTERED('Employee'[EmployeeID]),
MAX('Employee'[EmployeeID]),
USERPRINCIPALNAME()
)
You can then apply this measure as a visual-level filter, ensuring that the filtered data matches the logged-in user by setting the filter condition to = USERPRINCIPALNAME(). This additional measure ensures that even when the visual’s filters interact with the data model, the correct data is displayed for the user.
If applying these measures at the visual level impacts the performance of the report, consider optimizing the dataset by applying Row-Level Security (RLS) filters in Power BI Service. You can configure RLS roles to automatically limit data visibility to the logged-in user using USERPRINCIPALNAME().
An alternative way to prevent missing parameters is to update the Teams notification links to dynamically include a query parameter. The following URL structure can ensure that the filter is always applied based on the logged-in user:
https://app.powerbi.com/groups/yourworkspaceid/reports/yourreportid?filter=Employee[EmployeeID]=USERPRINCIPALNAME()
This approach automatically appends the filter parameter to the URL, avoiding the issue of unfiltered reports being displayed to users.
In summary, by using a combination of DAX measures and conditional filters, you can effectively ensure that the Power BI report shows only relevant data based on the logged-in user’s identity, even when URL parameters are missing. The use of the ISFILTERED() and USERPRINCIPALNAME() functions allows the report to dynamically adjust to the presence or absence of URL parameters, providing a seamless user experience and maintaining data security through RLS.
Best regards,
@DataNinja777 , as Dax cant be used at page level/report level filters, would you mind explaining how to make teams notification to dynamically include a query parameter?
Hi @LP280388 ,
You're absolutely right. Measures cannot be used as page-level or report-level filters in Power BI because they are dynamic, and filters require static values. The fundamental difference is that a measure is recalculated based on context, while filters expect a predefined column or field to filter by. This is also why measures cannot be used directly in slicers. But don't worry — there are several alternative approaches to achieve your desired filtering behavior with Row-Level Security (RLS).
One approach is to move your logic from a measure to a calculated column. Calculated columns are static at the time of data refresh and can be used in page filters or RLS rules. For example, if your measure is calculating sales performance based on a threshold, you could rewrite that logic as a calculated column. Instead of a measure like Sales Performance = IF(SUM(Sales[Amount]) > 100000, "High", "Low"), you could create a calculated column such as Sales Performance = IF(Sales[Amount] > 100000, "High", "Low"). This static column can now be used as a filter at the page or report level, or in your RLS setup.
Another way to achieve this is by creating a bridge table with static values and linking it to your main fact table. The bridge table should contain the values you want to filter by, and you can use it in your RLS rules or as a page filter. For instance, if you want to filter by region based on the user, you could create a table that maps users to regions and set up a rule like [User] = USERNAME(). This table can help apply dynamic filtering based on who is viewing the report.
If your goal is to apply a measure as a global filter across the entire page, you could try using visual-level filters as a workaround. One way to achieve this is by creating a card visual that displays the measure's result and applying a visual-level filter on that card. You can then hide the card by placing it off the canvas or reducing its transparency, effectively using it as a hidden global filter.
Another effective option is to use dynamic security tables for your RLS setup. Instead of relying on measures, create a security table with mappings between users and the rows they should see. This method ensures that the filtering happens at the data model level through the security table, making it more efficient and scalable for RLS. The RLS rule can then be set to dynamically filter the data based on the logged-in user's identity.
Lastly, if you're looking to give users control over dynamic filtering, you can use a What-If parameter combined with your RLS logic. What-If parameters generate a list of predefined values that users can select, which in turn updates your report visuals dynamically. This approach allows for more flexible filtering while maintaining the integrity of your RLS rules.
Best regards,
@DataNinja777 , Thanks for your response. The Userprinciplename() or username() cant be used directly or indirectly in the table calculation. thats the limitation.
the question here is how to know if the report url has a parameter or not and based on that show user himself when there is no parameter, show any of his directs when there is a parameter.
This deciding should happen dynamically when the user opens the report itself and not with the What-If parameters where user chooses the value
@DataNinja777 , Thanks for your response.
However, As i said in my original post Measures cant be used at page level / report level filters.
"In power bi desktop, measure can only be put into the visual filter, page filter is not supported. The principle in page filter is the same as that you can also not put measures into a slicer. Measure is dynamic not static, we cannot use a dynamic value to control the whole page visuals "
Is there any other way to do this in RLS?