Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
I'll try to explain my issue as best as I can. I'm mainly a developer and have just started trying to embed a report as per requested.
I'm trying to change som filters (or slicers) on load. But I'm not sure what I need to do in order to achieve this.
I've been messing around in the PBI playground for 2 days without getting any closer to achieve my goal.
Im trying to change these filters in the drop down uplon load. I want to manipulate which checkboxes are checked upon load.
(red line is company Name)
In powerBI I see it is structured as a Filter:
Where it looks like RegionName is the attribute I want to filter on.
When I console.log active filters in the PBI playground I see the following:
So I know the column and table
I've tried adding/replacing filter with this schema:
With no luck. I've also tried to apply it as a hierarchy-slicer as per docs:
https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/control-report-slicers#hierarchy-s...
Which I also am not getting to work.
Can anyone clarify what I'm doing wrong here? Or at least give me a pinpoint to what API i need to use? I'm confused wether I will achieve said goal with basic filter or if I need to use slicer. I hope my issue was clear. Thank alot!
HI @Abrandhaug,
What type of effect did you want? Did you mean to set the filter with static items?
If that is the case, I'd like to suggest you use the bookmark to save the filter effect, then you can enable this to restore the saved filter effects.
Enhance your users' experience with bookmarks in Power BI embedded analytics | Microsoft Learn
If you mean dynamic change items after report load, I think you needed to manually define the filter structure and use update filter API to update these filter items.
Use filters when embedding a report in Power BI embedded analytics | Microsoft Learn
Regards,
Xiaoxin Sheng
Hi, yes - I want to set the filter with static items(The RegionName filter) before the report loads in my web-application. The idea is to manipulate the filter based on who's viewing the report in the web application. I want this effect to be applied before the report loads.
Still looks to me like I need to use the API: Control report filters
When I console.log visual filters - I find the filter I want to manipulate:
this is the same filter as I see in the report:
I want to target this filter and change so that the checkboxes on the left side menu is not selected as the report loads.
I want to load the report with only one of the checkboxes selected.
If I try to set filters like this before the report loads. Nothing happens - and I'm confused what I'm doing wrong here.
const basicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "manageunit_dim_companyhierarchy",
column: "RegionName"
},
operator: "NotIn",
values: ["Energi", "Region Oslo", "Regioner Norge"],
filterType: models.FilterType.BasicFilter,
requireSingleSelection: false
}
I've also tried manipulating the checkboxes with this filter with no luck:
const filter = {
"$schema": "http://powerbi.com/product/schema#hierarchy",
"target": [
{
"table": "manageunit_dim_companyhierarchy",
"column": "CompanyName"
},
{
"table": "manageunit_dim_companyhierarchy",
"column": "RegionName"
}
],
"filterType": 9,
"hierarchyData": [
{
"operator": "Inherited",
"value": "CompanyName AS",
"children": [
{
"operator": "NotSelected",
"value": "Energi",
}
]
}
]
};
HI @Abrandhaug,
I'd like to suggest you enable the RLS with username in power bi embedded, then these records can be filtered automate based on the user name. (you only need to modify the report to map the field you want to filter with the username)
Solved: RLS with UserName() - Microsoft Power BI Community
Regards,
Xiaoxin Sheng
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 |