<?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 Re: Power BI Embedded - Filters in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/461735#M14213</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Geetha,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What is the type of the filter? If it's a visual level filter, we should get the report first and then get the page and the visual. At last we can set the filter.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;// Build the filter you want to use. For more information, See Constructing
// Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
const filter = {
  $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Store",
    column: "Chain"
  },
  operator: "In",
  values: ["Fashions Direct"]
};

// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];

// Get a reference to the embedded report.
&lt;FONT color="#0000FF"&gt;report = powerbi.get&lt;/FONT&gt;(embedContainer);

// Retrieve the page collection and get the visuals for the first page.
&lt;FONT color="#0000FF"&gt;report.getPages()&lt;/FONT&gt;
  .then(function (pages) {

    // Retrieve active page.
    var &lt;FONT color="#0000FF"&gt;activePage&lt;/FONT&gt; = pages.find(function(page) {
      return page.isActive
    });

    &lt;FONT color="#0000FF"&gt;activePage.getVisuals()&lt;/FONT&gt;
      .then(function (visuals) {

        // Retrieve the wanted visual.
        &lt;FONT color="#0000FF"&gt;var visual = visuals.find&lt;/FONT&gt;(function(visual) {
          return visual.name == "VisualContainer3";
        });

        // Set the filter for the visual.
        // Pay attention that setFilters receives an array.
        &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;visual.setFilters([filter])&lt;/FONT&gt;&lt;/STRONG&gt;
            .catch(function (errors) {
                Log.log(errors);
            });
        })
        .catch(function (errors) {
            Log.log(errors);
        });
  })
  .catch(function (errors) {
      Log.log(errors);
  });&lt;/PRE&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jul 2018 08:34:17 GMT</pubDate>
    <dc:creator>v-jiascu-msft</dc:creator>
    <dc:date>2018-07-13T08:34:17Z</dc:date>
    <item>
      <title>Power BI Embedded - Filters</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/460804#M14186</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Greetings,&amp;nbsp;I had been created an Alert Data report with two parameters such as Start Date and End Date, the scenario of the report is that the user will first select the Start Date and End Date, and according to that date range the report will be displayed for that particular data. The report was working fine and I had published it to the Power BI Service too and there also the parameters are perfectly working.&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I had embedded that report into an Asp.Net MVC application using one of the Power BI developer samples [App Owns Data] in GitHub. The report had been embedded and working fine. The issue is, the parameters are not working in the Power BI Embedded. In the web app I had created 2 list boxes for the Start Date and End Date and a button, the report will be displayed once the user selects the dates from the list boxes and clicks the button. I have used the javascript to set the filters for the parameters but the filters are not reflected in the report.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;Requesting for a solution or suggestion to accomplish this scenario. I have attached the code for reference.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;const filter1 =
            {
                $schema: "http://powerbi.com/product/schema#advanced",
                target: 
                {
                    table: "Alert",
                    column: "Date"
                },
                logicalOperator: "And",
                conditions: 
                [
                    {
                        operator: "GreaterThanOrEqual",
                        value: sd
                    },
                    {
                        operator: "LessThanOrEqual",
                        value: ed
                    }
                ],
            };

            var reportContainer = $('#reportContainer')[0];

            var report = powerbi.embed(reportContainer, config);

            //report.on('loaded', event =&amp;gt; { report.getFilters().then(filters =&amp;gt; { filters.push(filter1); return report.setFilters(filters); }) });

            report.setFilters([filter1]);&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 12 Jul 2018 09:55:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/460804#M14186</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-12T09:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded - Filters</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/461697#M14208</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suggest you try the online demo &lt;A href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#" target="_self"&gt;here&lt;/A&gt;. You also can download &lt;A href="https://github.com/Microsoft/PowerBI-JavaScript" target="_self"&gt;the source code&lt;/A&gt;. It could be like below.&lt;/P&gt;
&lt;PRE&gt;// Build the filter you want to use. For more information, See Constructing
// Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
const filter = {
  $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Store",
    column: "Chain"
  },
  operator: "In",
  values: ["Fashions Direct"]
};

// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];

// Get a reference to the embedded report.
report = powerbi.get(embedContainer);

// Retrieve the page collection and get the visuals for the first page.
report.getPages()
  .then(function (pages) {

    // Retrieve active page.
    var activePage = pages.find(function(page) {
      return page.isActive
    });

    activePage.getVisuals()
      .then(function (visuals) {

        // Retrieve the wanted visual.
        var visual = visuals.find(function(visual) {
          return visual.name == "VisualContainer3";
        });

        // Set the filter for the visual.
        // Pay attention that setFilters receives an array.
        visual.setFilters([filter])
            .catch(function (errors) {
                Log.log(errors);
            });
        })
        .catch(function (errors) {
            Log.log(errors);
        });
  })
  .catch(function (errors) {
      Log.log(errors);
  });&lt;/PRE&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 07:50:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/461697#M14208</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-07-13T07:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded - Filters</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/461724#M14212</link>
      <description>&lt;P&gt;Hai&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/28904"&gt;@v-jiascu-msft&lt;/a&gt;&amp;nbsp;thank you for your response, I had already tried the online demo but yet I couldn't able to find the bug.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Geetha&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 08:23:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/461724#M14212</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-13T08:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded - Filters</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/461735#M14213</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Geetha,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What is the type of the filter? If it's a visual level filter, we should get the report first and then get the page and the visual. At last we can set the filter.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;// Build the filter you want to use. For more information, See Constructing
// Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
const filter = {
  $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Store",
    column: "Chain"
  },
  operator: "In",
  values: ["Fashions Direct"]
};

// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];

// Get a reference to the embedded report.
&lt;FONT color="#0000FF"&gt;report = powerbi.get&lt;/FONT&gt;(embedContainer);

// Retrieve the page collection and get the visuals for the first page.
&lt;FONT color="#0000FF"&gt;report.getPages()&lt;/FONT&gt;
  .then(function (pages) {

    // Retrieve active page.
    var &lt;FONT color="#0000FF"&gt;activePage&lt;/FONT&gt; = pages.find(function(page) {
      return page.isActive
    });

    &lt;FONT color="#0000FF"&gt;activePage.getVisuals()&lt;/FONT&gt;
      .then(function (visuals) {

        // Retrieve the wanted visual.
        &lt;FONT color="#0000FF"&gt;var visual = visuals.find&lt;/FONT&gt;(function(visual) {
          return visual.name == "VisualContainer3";
        });

        // Set the filter for the visual.
        // Pay attention that setFilters receives an array.
        &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;visual.setFilters([filter])&lt;/FONT&gt;&lt;/STRONG&gt;
            .catch(function (errors) {
                Log.log(errors);
            });
        })
        .catch(function (errors) {
            Log.log(errors);
        });
  })
  .catch(function (errors) {
      Log.log(errors);
  });&lt;/PRE&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 08:34:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/461735#M14213</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-07-13T08:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded - Filters</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/461869#M14219</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/28904"&gt;@v-jiascu-msft&lt;/a&gt;, it is a Report level filter...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Geetha&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 10:49:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/461869#M14219</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-13T10:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded - Filters</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/493963#M15125</link>
      <description>&lt;P&gt;Any solutions to this question...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Geetha&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 10:20:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/493963#M15125</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-20T10:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded - Filters</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/509242#M15698</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I implemented Embedded-filter in my reports too. but it is not working since today morning. I went to the demo site but it is also not working here, Please update us if Microsoft&amp;nbsp;is making some changes in embedded&amp;nbsp;filter option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html" target="_blank"&gt;https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Deepak&amp;nbsp;Kumar Mishra&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;deepak@gs1india.org&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 11:41:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-Filters/m-p/509242#M15698</guid>
      <dc:creator>dkumar346</dc:creator>
      <dc:date>2018-09-06T11:41:28Z</dc:date>
    </item>
  </channel>
</rss>

