<?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: Trying to filter data in custom visual in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Trying-to-filter-data-in-custom-visual/m-p/370487#M11048</link>
    <description>&lt;P&gt;Hello&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At first you should add the &lt;STRONG&gt;filter&lt;/STRONG&gt; option into capabilities.json:&lt;/P&gt;
&lt;PRE&gt;"objects": {
    "general": {
        "displayName": "General",
        "properties": {
            "filter": {
                "type": {
                    "filter": true
                }
            }
        }
    }
}&lt;/PRE&gt;
&lt;P&gt;As a final step you should call &lt;STRONG&gt;selectionManager.&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;applySelectionFilter()&lt;/STRONG&gt; after calling &lt;STRONG&gt;selectionManager&lt;/STRONG&gt;&lt;STRONG&gt;.select.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please apply the necessary changes to your code base and let us know if that works well?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Ignat Vilesov,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Software Engineer&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2018 08:10:15 GMT</pubDate>
    <dc:creator>v-viig</dc:creator>
    <dc:date>2018-03-07T08:10:15Z</dc:date>
    <item>
      <title>Trying to filter data in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Trying-to-filter-data-in-custom-visual/m-p/369949#M11039</link>
      <description>&lt;P&gt;Good evening,&lt;/P&gt;&lt;P&gt;I'm relatively new to Power BI and want to create a filter for my data in my custom visual so my data will be updated in every other visual/slicer on the same page. Right now I have this d3 graph with a click event on an edge which gives me an array of slection ids. These ids I am passing to the selectionManager and select them. The result is highlighted data in every other visual, but how can i create a filter out of this selection (like a filter I get from a slicer).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code (summarized)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;capabilities.json:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"dataRoles": [
        {
            "displayName": "Aktivität",
            "name": "activity",
            "kind": "Grouping"
        },
        {
            "displayName": "Aktivitäts-ID",
            "name": "activityid",
            "kind": "Grouping"
        },
        {
            "displayName": "Fall-ID",
            "name": "caseid",
            "kind": "Grouping"
        },
        {
            "displayName": "Variante",
            "name": "path",
            "kind": "Grouping"
        },
        {
            "displayName": "Zeitstempel",
            "name": "timestamp",
            "kind": "Grouping"
        }
    ],
    "dataViewMappings": [
        {
            "table":{
                "rows": {
                    "select": [
                        {
                            "for": { "in": "caseid"}
                        },
                        {
                            "for": { "in": "activity"}
                        },
                        {
                            "for": { "in": "activityid"}
                        },
                        {
                            "for": { "in": "path"}
                        },
                        {
                            "for": { "in": "timestamp"}
                        }
                    ],
                    "dataReductionAlgorithm": {
                      "top": {
                          "count": 500000
                      }
                    }
                }
            }
        }
    ],&lt;/PRE&gt;&lt;P&gt;&lt;U&gt;visual.ts:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;interface EventLogdata {
        activityid: any,
        activity: string,
        caseid: any,
        path: string,
        timestamp: any,
        selectionID: ISelectionId;
    }

------------------------------------------

function getSelectionIds(dataView: DataView, host: IVisualHost): ISelectionId[] {
        return dataView.table.identity.map((identity: DataViewScopeIdentity) =&amp;gt; {
            const categoryColumn: DataViewCategoryColumn = {
                source: dataView.table.columns[1],
                values: null,
                identity: [identity]
            };

            return host.createSelectionIdBuilder()
                .withCategory(categoryColumn, 0)
                .createSelectionId();
        });
    }
-------------------------------------------

function visualTransform(options: VisualUpdateOptions, host: IVisualHost): FlowchartViewModel {
...
...
        let tableSelectionId: ISelectionId[] = getSelectionIds(dataViews[0],host);

...
...
for (let i = 0; i &amp;lt; rows.length; i++) {
            eventlogData.push({
                activityid: rows[i][index_activityid],
                activity: &amp;lt;string&amp;gt;rows[i][index_activity],
                caseid: rows[i][index_caseid],
                path: &amp;lt;string&amp;gt;rows[i][index_path],
                timestamp: valueFormatterUK.format(rows[i][index_timestamp]),
                selectionID: tableSelectionId[i],
            });
        }

------------------------------

public update(options: VisualUpdateOptions, edge) {

d3.selectAll("g.edgePath, .edgeLabel").on("click", function(e) { 
      
                   let selectionIdArray = PSEUDO: this is my array with the selected selection ids

                    selectionManager.select(selectionIdArray, true);
                }
            });

}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 17:53:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Trying-to-filter-data-in-custom-visual/m-p/369949#M11039</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-05T17:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to filter data in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Trying-to-filter-data-in-custom-visual/m-p/370487#M11048</link>
      <description>&lt;P&gt;Hello&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At first you should add the &lt;STRONG&gt;filter&lt;/STRONG&gt; option into capabilities.json:&lt;/P&gt;
&lt;PRE&gt;"objects": {
    "general": {
        "displayName": "General",
        "properties": {
            "filter": {
                "type": {
                    "filter": true
                }
            }
        }
    }
}&lt;/PRE&gt;
&lt;P&gt;As a final step you should call &lt;STRONG&gt;selectionManager.&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;applySelectionFilter()&lt;/STRONG&gt; after calling &lt;STRONG&gt;selectionManager&lt;/STRONG&gt;&lt;STRONG&gt;.select.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please apply the necessary changes to your code base and let us know if that works well?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Ignat Vilesov,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Software Engineer&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 08:10:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Trying-to-filter-data-in-custom-visual/m-p/370487#M11048</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2018-03-07T08:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to filter data in custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Trying-to-filter-data-in-custom-visual/m-p/370730#M11060</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/17823"&gt;@v-viig&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this works perfectly! Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 15:41:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Trying-to-filter-data-in-custom-visual/m-p/370730#M11060</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-06T15:41:20Z</dc:date>
    </item>
  </channel>
</rss>

