Forum Discussion
how to filter the publish to web report using query string filter?
Hi, automation
As you mentioned, the idea of implementing post-"publish to web" slicer filtering via JavaScript is very clear. Here are the brief steps to achieve it:
1. First, publish the report on the web.
2. Open the developer tools in your browser, which can usually be opened by right-clicking on the page and selecting "Inspect" or pressing F12.
3. In the console, you can find the HTML tag of the slicer, usually the slicerItemContainer.
4. Achieve the selected state by controlling the aria-selected attribute. You can get that tag using the getElementsByClassName method in JavaScript.
Document: getElementsByClassName() method - Web APIs | MDN
5. Use the setAttribute method to set the value of the aria-selected attribute to implement the filtering function of the slicer.
Element: setAttribute() method - Web APIs | MDN
This approach is beyond the scope of Power BI support. You should implement this according to your development department.
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.