<?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: Categorical data view mapping with non-numerical values in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1005557#M22930</link>
    <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;It's not necessarily that the &lt;FONT face="courier new,courier"&gt;categorical&lt;/FONT&gt; data view mapping only supports numeric values; it will only populate the values object if the data role for &lt;FONT face="courier new,courier"&gt;values&lt;/FONT&gt; is aggegrated - this could be a numeric value, or some kind of valid textual aggregate such as &lt;STRONG&gt;first&lt;/STRONG&gt; or &lt;STRONG&gt;last&lt;/STRONG&gt;. Either way, a valid mapping would only resolve one value per &lt;FONT face="courier new,courier"&gt;category&lt;/FONT&gt; in this scenario.&lt;/P&gt;
&lt;P&gt;I have a similar challenge with one of my visuals, where the only way I'm able to 'force' the grain of the data is to introduce a 'sampling' or 'index' value, which generates a unique value for each row of the datset that the user needs to add into their data roles. &lt;A href="https://coacervo.co/violin-plot-sampling" target="_self"&gt;I wrote up my findings here&lt;/A&gt;, which might provide some additional useful context for you. This approach requires work from the user's side, which is not ideal but is the only way I can get it to work with the way that Power BI provides data in this scenario.&lt;/P&gt;
&lt;P&gt;If you didn't need highlighting, the &lt;FONT face="courier new,courier"&gt;table&lt;/FONT&gt; dataViewMapping would be my go-to, but that's not suitable for you either.&lt;/P&gt;
&lt;P&gt;I spent some time, and trying to keep to your requirements, the best I could get was with the configuration below. Note that this only worked if I manually specified an aggregate (e,g, first) for &lt;FONT face="courier new,courier"&gt;category&lt;/FONT&gt;, which would still require some education for the end-user:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
    "dataRoles": [
        {
            "displayName": "Guid",
            "name": "guid",
            "kind": "Grouping"
        },
        {
            "displayName": "Color grouping",
            "name": "category",
            "kind": "GroupingOrMeasure"
        }
    ],
    ...
    "dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "select": [
                        {
                            "for": {
                                "in": "guid"
                            }
                        },
                        {
                            "bind": {
                                "to": "category"
                            }
                        }
                    ],
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                    "bind": {
                        "to": "category"
                    }
                }
            }
        }
    ],
    "supportsHighlight": true
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd be keen to see if this can be improved by anyone else, but with the current limits of my knowledge, I would probably go with the dummy measure &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I hope this helps in some way,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Thu, 02 Apr 2020 20:09:25 GMT</pubDate>
    <dc:creator>dm-p</dc:creator>
    <dc:date>2020-04-02T20:09:25Z</dc:date>
    <item>
      <title>Categorical data view mapping with non-numerical values</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1005170#M22924</link>
      <description>&lt;P&gt;Hi! I'm building a visual which draws geometry from a 3d file which is uploaded through a button in html and then stored as a string object in the visual's properties. Each object in the file has a guid id (string), which I'd like to use to link the objects with data in the dashboard. So, in capabilities.json I have data roles like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"dataRoles": [
  {
    "displayName": "Guid",
    "name": "guid",
    "kind": "GroupingOrMeasure"
  },
  {
    "displayName": "Color grouping",
    "name": "category",
    "kind": "GroupingOrMeasure"
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But now I'm not sure how to set up the dataViewMappings. I'd really prefer to use categorical, in order to support getting highlights. The sticking point seems to be that as far as I can tell categorical's `values` object only works with numerical values (undocumented, as far as I have found). So, if I do something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"categorical": {
  "categories": {
    "bind": {
      "to": "category"
    }
  },
  "values": {
    "for": {
      "in": "guid"
    }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Dataview I get category values for each of the guids, but no values array. And, if I try to highlight some values from another visual, no highlights array comes through.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what does work is to set up categorical with both my `category` and `guid` data as categories, and then add a dummy numerical dataRole in `values`:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;...
  {
    "displayName": "Required dummy numerical data",
    "name": "data",
    "kind": "GroupingOrMeasure"
  }
],
"dataViewMappings": [
  {
    "categorical": {
      "categories": {
        "select": [
          {
            "for": {
              "in": "guid"
            }
          },
          {
            "bind": {
              "to": "category"
            }
          }
        ],
        "dataReductionAlgorithm": {
          "top": {}
        }
      },
      "values": {
        "bind": {
          "to": "data"
        }
      }
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now in Dataview I get all the data I need, plus the array of dummy data, and even though the values in the highlights array are meaningless, I can look for nulls in order to filter. But of course I'd really prefer not to have to require this hack of the client. Is there another way to do this that I'm missing?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 15:26:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1005170#M22924</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-02T15:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical data view mapping with non-numerical values</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1005557#M22930</link>
      <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;It's not necessarily that the &lt;FONT face="courier new,courier"&gt;categorical&lt;/FONT&gt; data view mapping only supports numeric values; it will only populate the values object if the data role for &lt;FONT face="courier new,courier"&gt;values&lt;/FONT&gt; is aggegrated - this could be a numeric value, or some kind of valid textual aggregate such as &lt;STRONG&gt;first&lt;/STRONG&gt; or &lt;STRONG&gt;last&lt;/STRONG&gt;. Either way, a valid mapping would only resolve one value per &lt;FONT face="courier new,courier"&gt;category&lt;/FONT&gt; in this scenario.&lt;/P&gt;
&lt;P&gt;I have a similar challenge with one of my visuals, where the only way I'm able to 'force' the grain of the data is to introduce a 'sampling' or 'index' value, which generates a unique value for each row of the datset that the user needs to add into their data roles. &lt;A href="https://coacervo.co/violin-plot-sampling" target="_self"&gt;I wrote up my findings here&lt;/A&gt;, which might provide some additional useful context for you. This approach requires work from the user's side, which is not ideal but is the only way I can get it to work with the way that Power BI provides data in this scenario.&lt;/P&gt;
&lt;P&gt;If you didn't need highlighting, the &lt;FONT face="courier new,courier"&gt;table&lt;/FONT&gt; dataViewMapping would be my go-to, but that's not suitable for you either.&lt;/P&gt;
&lt;P&gt;I spent some time, and trying to keep to your requirements, the best I could get was with the configuration below. Note that this only worked if I manually specified an aggregate (e,g, first) for &lt;FONT face="courier new,courier"&gt;category&lt;/FONT&gt;, which would still require some education for the end-user:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
    "dataRoles": [
        {
            "displayName": "Guid",
            "name": "guid",
            "kind": "Grouping"
        },
        {
            "displayName": "Color grouping",
            "name": "category",
            "kind": "GroupingOrMeasure"
        }
    ],
    ...
    "dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "select": [
                        {
                            "for": {
                                "in": "guid"
                            }
                        },
                        {
                            "bind": {
                                "to": "category"
                            }
                        }
                    ],
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                    "bind": {
                        "to": "category"
                    }
                }
            }
        }
    ],
    "supportsHighlight": true
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd be keen to see if this can be improved by anyone else, but with the current limits of my knowledge, I would probably go with the dummy measure &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I hope this helps in some way,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 20:09:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1005557#M22930</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2020-04-02T20:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical data view mapping with non-numerical values</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1007366#M22940</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;It's not necessarily that the &lt;FONT face="courier new,courier"&gt;categorical&lt;/FONT&gt; data view mapping only supports numeric values; it will only populate the values object if the data role for &lt;FONT face="courier new,courier"&gt;values&lt;/FONT&gt; is aggegrated&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks! That's very helpful to know. I think I'll actually go with your version as I think it might appear &lt;EM&gt;slightly&lt;/EM&gt; less hacky. Thanks for taking the time to explore! And yes, I too would love to see a better alternative. I'll accept your solution in a while if no one comes along with something better.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 16:14:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1007366#M22940</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-03T16:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical data view mapping with non-numerical values</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1007402#M22942</link>
      <description>&lt;P&gt;Hmm. Actually, I ran into another issue with something I didn't mention. I'm also using the category to color objects through the Format pane, so (according to my limited understanding) I need the `objects` object to be present on the category data in the dataview. With capabilities as you have it above, the category only comes in on the `values` object, which I'm guessing is why it doesn't carry the `objects` data. Guess we're back to dummy data, unless I've missed something.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 16:44:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1007402#M22942</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-03T16:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical data view mapping with non-numerical values</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1040351#M23241</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been using the dummy data method, which works well for most things, but have run into an issue that I believe it's causing. Maybe there's a workaround?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As mentioned in my last post, I'm trying to use the category to color objects through the Format pane. This works, until the visual is filtered. I think what is happening, is that because we have the guid set as a second category, the Format pane colors are tied to specific combinations of category and guid, not just a category. If the specific guid-category combination that we used to create the color picker in the Format pane is not still visible in the filtered view, then no color is passed in and we get a default theme color.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't see any way around this, but I'm hoping someone else can!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 22:10:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Categorical-data-view-mapping-with-non-numerical-values/m-p/1040351#M23241</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-21T22:10:50Z</dc:date>
    </item>
  </channel>
</rss>

