Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
davidjackson
Regular Visitor

Filter not working, just reloading the page

Hi All

 

I have a powerBI embedded report using a PBIX with embedded csv data. The report shows up find but I can't filter on it.

I created a test below to try but all that happens when I try is it reloads the page.

 

The problem seems to be with removeFilters() and getFilters()

Both are throwing an error that I can't trap 😞

Any help would be very much appreciated

 

 

function addFilter() {
//clearFilters();
//debugger;
//var target = $('#filter-target').val();
//var table = $('#filter-table').val();
//var column = $('#filter-column').val();
//var value = ''; // $('#filter-value').val();
var basicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
//table: "tblEIMMaster",
//column: "Activity"
table: "Eimdata20170203",
column: "ID"
},
operator: "In",
values: [69872, 69719, 69863, 69880, 69598, 69604, 68796, 69555, 69091, 67951]
};

 

4 REPLIES 4
davidjackson
Regular Visitor

Hi All

 

I have a powerBI embedded report using a PBIX with embedded csv data. The report shows up find but I can't filter on it.

I created a test below to try but all that happens when I try is it reloads the page.

 

The problem seems to be with removeFilters() and getFilters()

Both are throwing an error that I can't trap 😞

Any help would be very much appreciated

 

function addFilter() {
//clearFilters();
//debugger;
//var target = $('#filter-target').val();
//var table = $('#filter-table').val();
//var column = $('#filter-column').val();
//var value = ''; // $('#filter-value').val();
var basicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
//table: "tblEIMMaster",
//column: "Activity"
table: "Eimdata20170203",
column: "ID"
},
operator: "In",
values: [69872, 69719, 69863, 69880, 69598, 69604, 68796, 69555, 69091, 67951]
};

 

@davidjackson

The basic filter actually works in my test. Check my demo, replace the token and reportid with them in your case.

 

<html>

 <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/powerbi-client/dist/powerbi.js"></script>
 
 <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/jquery/dist/jquery.js"></script>  
 
<script type="text/javascript">
window.onload = function () { 
  var  IamAFilter = {
        $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Eimdata20170203",
    column: "ID"
  },
  operator: "In",
  values: [69872, 69719, 69863, 69880, 69598, 69604, 68796, 69555, 69091, 67951]
}
 

var embedConfiguration = {
    type: 'report',
    accessToken: 'eyJ0eXAiOiJKV1QiLxxxxa3NwY0NsbGN0xxxxxxxxxxxxxDMzYxxxxxRmMi1kOWxxxxI0NjEiLCJyaWQiOiJlNmI4ZmY0Yy1lZjE2LTRkZDItOWIxNy1jNDk2Mjg3NDFmOGYiLCJ1c2VybmFtZSI6IkVSSUNaSEFORyIsInJvbGVzIjoiU2VlMXN0IiwiaXNzIjoiUG93ZXJCSVNESyIsImF1ZCI6Imh0dHBzOi8vYW5hbHlzaXMud2luZG93cy5uZXQvcG93ZXJiaS9hcGkiLCJleHAiOjE0ODkwMzI1NjcsIm5iZiI6MTQ4OTAyODk2N30.xoYHlGQ3Cy95DfW55EOZIgGxT5oZ5cLgNfUBttkaKDw',
     
    embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed?reportId=xxxxx17-c49628741f8f',
	filters:[IamAFilter], // the filters is an array here, you can add more filter like [filter1,filter2,filter3]
	settings: {
        filterPaneEnabled: true //hide the filterPane so that your user can't change the filter to see more data, this is not a strong security, anyone who's familar with javascript can bypass it
    }

}; 
 

var $reportContainer = $('#reportContainer');
 
var report = powerbi.embed($reportContainer.get(0), embedConfiguration); 


}
</script>

<div id="reportContainer" powerbi-settings-nav-content-pane-enabled="true"   powerbi-settings-filter-pane-enabled="true"></div>

</html>

I've narrowed it down to here (see below)

 

for some reason the "targetWindow" value is not available

 

                    HttpPostMessage.prototype.send = function (request, targetWindow) {
                        if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; }
                        request.headers = this.assign({}, this.defaultHeaders, request.headers);
                        if (!targetWindow) {
                            throw new Error("target window is not provided.  You must either provide the target window explicitly as argument to request, or specify default target window when constructing instance of this class.");
                        }
                        return this.windowPostMessageProxy.postMessage(targetWindow, request);
                    };
Anonymous
Not applicable

I am seeing the same thing. Did you ever get this figured out?

 

Thanks,


Stizz001

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.