<?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: Set slicer value upon load Javascript API in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/481937#M14786</link>
    <description>&lt;P&gt;Update the report ID: CRI&amp;nbsp;79433674.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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>Tue, 07 Aug 2018 02:49:04 GMT</pubDate>
    <dc:creator>v-jiascu-msft</dc:creator>
    <dc:date>2018-08-07T02:49:04Z</dc:date>
    <item>
      <title>Set Relative Date Slicer value upon load Javascript API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/478522#M14669</link>
      <description>&lt;P&gt;Hi all!,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im attempting to set a slicer value upon report load. According to this documentation this can be done:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Slicers" target="_blank"&gt;https://github.com/Microsoft/PowerBI-JavaScript/wiki/Slicers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone please check my code below to see if i'm missing something or help confirm that this functionality is not working?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        var filter = new models.RelativeDateFilter(
            {
            table: "D_DATE",
            column: "DATE_VALUE"
            },
            models.RelativeDateOperators.InLast,
            30,
            models.RelativeDateFilterTimeUnit.Days,
            true
        );

        //relative date
        slicerObj.push({
            selector: new models.VisualSelector("a0625ab0110ec10492e3"),
            state: filter
        });


        var config = {
            type: 'report',
            tokenType: models.TokenType.Embed,
            accessToken: accessToken,
            pageName: summaryPage,
            embedUrl: embedUrl,
            filters: basicFilter,
            slicers: slicerObj, //THIS DOESN'T DO ANYTHING?
            id: embedReportId,
            permissions: models.Permissions.All,
            settings: {
                filterPaneEnabled: true,
                navContentPaneEnabled: true
            }
        }; &lt;BR /&gt;&lt;BR /&gt;       var reportContainer = $('#reportContainer')[0];&lt;BR /&gt;       var report = powerbi.embed(reportContainer, config);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 03:07:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/478522#M14669</guid>
      <dc:creator>fatgreycat</dc:creator>
      <dc:date>2018-08-22T03:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Set slicer value upon load Javascript API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/480721#M14737</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/74895"&gt;@fatgreycat&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have consulted some experts. I will update here when I get the answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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>Mon, 06 Aug 2018 02:45:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/480721#M14737</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-08-06T02:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Set slicer value upon load Javascript API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/481937#M14786</link>
      <description>&lt;P&gt;Update the report ID: CRI&amp;nbsp;79433674.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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>Tue, 07 Aug 2018 02:49:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/481937#M14786</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-08-07T02:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Set slicer value upon load Javascript API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/481941#M14787</link>
      <description>&lt;P&gt;Hi Dale,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry I don't understand what you are asking me to do?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 02:53:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/481941#M14787</guid>
      <dc:creator>fatgreycat</dc:creator>
      <dc:date>2018-08-07T02:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Set slicer value upon load Javascript API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/481969#M14788</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/74895"&gt;@fatgreycat&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for the confusion. It's a reference to other teams. You don't need to do anything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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>Tue, 07 Aug 2018 03:20:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/481969#M14788</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-08-07T03:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set slicer value upon load Javascript API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/488714#M14980</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/74895"&gt;@fatgreycat&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There aren't any issues. I made it work with the following code finally. (the main part is as follows.)&lt;/P&gt;
&lt;PRE&gt;var models = window['powerbi-client'].models;

const slicer_filter = 
    {
        selector: new models.VisualSelector("97cc6177cbc5e4a48834"),
        state: &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;{
            filters: [&lt;/FONT&gt;&lt;/STRONG&gt;
                {
                    "$schema": "http://powerbi.com/product/schema#basic",
                    "target": {
                        "table": "DimProduct",
                        "column": "ColorName"
                    },
                    "operator": "In",
                    "values": [
                        "Blue"
                    ]
                }
            ]
        }
    };

var config= {
    type: 'report',
    tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
    accessToken: txtAccessToken,
    embedUrl: txtEmbedUrl,
    id: txtEmbedReportId,
   &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt; slicers: [slicer_filter],&lt;/STRONG&gt;&lt;/FONT&gt;
    permissions: permissions
};

var embedContainer = $('#container')[0];
var report = powerbi.embed(embedContainer, config);&lt;/PRE&gt;
&lt;P&gt;So please check out these things below.&lt;/P&gt;
&lt;P&gt;1. The format of the filter,&lt;/P&gt;
&lt;P&gt;2. The slicer is an array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Dale&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 05:47:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/488714#M14980</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-08-14T05:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set slicer value upon load Javascript API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/493507#M15113</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/74895"&gt;@fatgreycat&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Could you please mark the proper answers as solutions?&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 02:17:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Set-Relative-Date-Slicer-value-upon-load-Javascript-API/m-p/493507#M15113</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-08-20T02:17:17Z</dc:date>
    </item>
  </channel>
</rss>

