<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Addling filter using javascript API (Power BI Service) in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Addling-filter-using-javascript-API-Power-BI-Service/m-p/133926#M4617</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to power BI. I added a basic filter to to the report&amp;nbsp;but it doesn't seem to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var config = {
    type: 'report',
    accessToken: txtAccessToken,
    embedUrl: txtEmbedUrl,
    id: txtEmbedReportId,
    settings: {
        filterPaneEnabled: true,
    }
};

var reportContainer = $('#reportContainer')[0];

var report = powerbi.embed(reportContainer, config);

var basicFilter = {
    $schema: "http://powerbi.com/product/schema#basic",
    target: {
        table: "Query1",
        column: "Email"
    },
    operator: 'In',
    values: "['test@domain.com']"
};

report.getFilters().then(function (allTargetFilters) {
    allTargetFilters.push(basicFilter);

    // Set filters
    // https://microsoft.github.io/PowerBI-JavaScript/interfaces/_src_ifilterable_.ifilterable.html#setfilters
    report.setFilters(allTargetFilters);
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advice.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2017 00:25:14 GMT</pubDate>
    <dc:creator>aroyappan</dc:creator>
    <dc:date>2017-02-28T00:25:14Z</dc:date>
    <item>
      <title>Addling filter using javascript API (Power BI Service)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Addling-filter-using-javascript-API-Power-BI-Service/m-p/133926#M4617</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to power BI. I added a basic filter to to the report&amp;nbsp;but it doesn't seem to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var config = {
    type: 'report',
    accessToken: txtAccessToken,
    embedUrl: txtEmbedUrl,
    id: txtEmbedReportId,
    settings: {
        filterPaneEnabled: true,
    }
};

var reportContainer = $('#reportContainer')[0];

var report = powerbi.embed(reportContainer, config);

var basicFilter = {
    $schema: "http://powerbi.com/product/schema#basic",
    target: {
        table: "Query1",
        column: "Email"
    },
    operator: 'In',
    values: "['test@domain.com']"
};

report.getFilters().then(function (allTargetFilters) {
    allTargetFilters.push(basicFilter);

    // Set filters
    // https://microsoft.github.io/PowerBI-JavaScript/interfaces/_src_ifilterable_.ifilterable.html#setfilters
    report.setFilters(allTargetFilters);
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advice.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 00:25:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Addling-filter-using-javascript-API-Power-BI-Service/m-p/133926#M4617</guid>
      <dc:creator>aroyappan</dc:creator>
      <dc:date>2017-02-28T00:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Addling filter using javascript API (Power BI Service)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Addling-filter-using-javascript-API-Power-BI-Service/m-p/134103#M4623</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/21880"&gt;@aroyappan&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;It is the brakets([]) wrapped by quotes that leads to error.&lt;/P&gt;
&lt;PRE&gt;values: ['test@domain.com'] //remove the quotes&lt;/PRE&gt;
&lt;P&gt;A demo which works perfect in my test, just for your reference. Check more details on &lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki" target="_self"&gt;PowerBI-JavaScript wiki&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;html&amp;gt;

 &amp;lt;script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/powerbi-client/dist/powerbi.js"&amp;gt;&amp;lt;/script&amp;gt;
 
 &amp;lt;script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/jquery/dist/jquery.js"&amp;gt;&amp;lt;/script&amp;gt;  
 
&amp;lt;script type="text/javascript"&amp;gt;
window.onload = function () { 
  var  IamAFilter = {
        $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Questions",
    column: "site"
  },
  operator: "In",
  values: ["stackoverflow"]
}
 

var embedConfiguration = {
    type: 'report',
    accessToken: 'YOUR TOKEN HERE',
    id: 'b7441d21XXXXXXXc5bd6426d',
    embedUrl: 'https://app.powerbi.com/reportEmbed?reportId=b7441d21-XXXXXXXX7c5bd6426d',
	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); 


}
&amp;lt;/script&amp;gt;

&amp;lt;div id="reportContainer" powerbi-settings-nav-content-pane-enabled="true"   powerbi-settings-filter-pane-enabled="true"&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;/html&amp;gt;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 06:20:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Addling-filter-using-javascript-API-Power-BI-Service/m-p/134103#M4623</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-02-28T06:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Addling filter using javascript API (Power BI Service)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Addling-filter-using-javascript-API-Power-BI-Service/m-p/810157#M21005</link>
      <description>&lt;P&gt;I have smilar issue but When I am adding Filter I have multiple parameter so if one of them is blank or null its not throwing filter at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;following is prototype of my code&lt;/P&gt;&lt;P&gt;const filter1= {&lt;BR /&gt;$schema: "&lt;A href="http://powerbi.com/product/schema#basic" target="_blank"&gt;http://powerbi.com/product/schema#basic&lt;/A&gt;",&lt;BR /&gt;target: {&lt;BR /&gt;table: "Table1",&lt;BR /&gt;column: "column1",&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;operator: "In",&lt;BR /&gt;values: [$("#val1").val()]&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;const filter2 = {&lt;BR /&gt;$schema: "&lt;A href="http://powerbi.com/product/schema#basic" target="_blank"&gt;http://powerbi.com/product/schema#basic&lt;/A&gt;",&lt;BR /&gt;target: {&lt;BR /&gt;table: "Table2",&lt;BR /&gt;column: "column2",&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;operator: "In",&lt;BR /&gt;values: [$("#val12").val()],&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var config = {&lt;BR /&gt;type: 'report',&lt;BR /&gt;tokenType: models.TokenType.Embed,&lt;BR /&gt;accessToken: accessToken,&lt;BR /&gt;embedUrl: embedUrl,&lt;BR /&gt;id: embedReportId,&lt;BR /&gt;permissions: models.Permissions.All,&lt;BR /&gt;filters: [filter1, filter2],&lt;BR /&gt;settings: {&lt;BR /&gt;filterPaneEnabled: false,&lt;BR /&gt;navContentPaneEnabled: false&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var reportContainer = $('#DivContainer')[0];&lt;/P&gt;&lt;P&gt;// Embed the report and display it within the div container.&lt;BR /&gt;var report = powerbi.embed(reportContainer, config);&lt;BR /&gt;&lt;BR /&gt;report.setFilters([filter1, filter2]);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so If filter2 is blank or null its not filtering Filter1 my charts ges blanks after this&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 17:44:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Addling-filter-using-javascript-API-Power-BI-Service/m-p/810157#M21005</guid>
      <dc:creator>khushbu123</dc:creator>
      <dc:date>2019-10-04T17:44:26Z</dc:date>
    </item>
  </channel>
</rss>

