<?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 Conditional Formatting - createDataViewWildcardSelector with Grouped Data in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Formatting-createDataViewWildcardSelector-with/m-p/4066884#M10215</link>
    <description>&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having some issues using the recommended `createDataViewWildcardSelector` when implementing conditional formatting for data with groupings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the `CircleCard` demo visual (from `pbiviz new CircleCard`), if I add conditional formatting support for font size using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    fontSize = new formattingSettings.NumUpDown({
        name: "fontSize",
        displayName: "Text Size",
        value: 12,
        selector: dataViewWildcard.createDataViewWildcardSelector(dataViewWildcard.DataViewWildcardMatchingOption.InstancesAndTotals),
        instanceKind: powerbi.VisualEnumerationInstanceKinds.ConstantOrRule
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The resulting dataview (as expected) has `objects` bound to each category:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andrjohns_0-1722251707387.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1140857i1A7DC7A1A7F86BD0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andrjohns_0-1722251707387.png" alt="andrjohns_0-1722251707387.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I update the dataview mapping to additionally group values:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    "dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "for": {
                        "in": "category"
                    },
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                    "group": {
                        "by": "grouping",
                        "select": [
                            {
                                "for": {
                                    "in": "measure"
                                }
                            }
                        ]
                    }
                }
            }
        }
    ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then `objects` is no longer bound to the `categories` (or anywhere in the dataview, for that matter):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andrjohns_1-1722251965809.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1140862i9F24D321212E58CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andrjohns_1-1722251965809.png" alt="andrjohns_1-1722251965809.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an alternate method that should be used for grouping/series? I've been trying different ways of specifying the `selector` input, but have had no luck so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it would be helpful, here's a repo with the (slightly) modified CircleCard example that reproduces the behaviour:&lt;BR /&gt;&lt;A href="https://github.com/andrjohns/circleCard-demo" target="_blank"&gt;https://github.com/andrjohns/circleCard-demo&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jul 2024 11:22:37 GMT</pubDate>
    <dc:creator>andrjohns</dc:creator>
    <dc:date>2024-07-29T11:22:37Z</dc:date>
    <item>
      <title>Conditional Formatting - createDataViewWildcardSelector with Grouped Data</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Formatting-createDataViewWildcardSelector-with/m-p/4066884#M10215</link>
      <description>&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having some issues using the recommended `createDataViewWildcardSelector` when implementing conditional formatting for data with groupings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the `CircleCard` demo visual (from `pbiviz new CircleCard`), if I add conditional formatting support for font size using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    fontSize = new formattingSettings.NumUpDown({
        name: "fontSize",
        displayName: "Text Size",
        value: 12,
        selector: dataViewWildcard.createDataViewWildcardSelector(dataViewWildcard.DataViewWildcardMatchingOption.InstancesAndTotals),
        instanceKind: powerbi.VisualEnumerationInstanceKinds.ConstantOrRule
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The resulting dataview (as expected) has `objects` bound to each category:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andrjohns_0-1722251707387.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1140857i1A7DC7A1A7F86BD0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andrjohns_0-1722251707387.png" alt="andrjohns_0-1722251707387.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I update the dataview mapping to additionally group values:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    "dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "for": {
                        "in": "category"
                    },
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                    "group": {
                        "by": "grouping",
                        "select": [
                            {
                                "for": {
                                    "in": "measure"
                                }
                            }
                        ]
                    }
                }
            }
        }
    ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then `objects` is no longer bound to the `categories` (or anywhere in the dataview, for that matter):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andrjohns_1-1722251965809.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1140862i9F24D321212E58CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andrjohns_1-1722251965809.png" alt="andrjohns_1-1722251965809.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an alternate method that should be used for grouping/series? I've been trying different ways of specifying the `selector` input, but have had no luck so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it would be helpful, here's a repo with the (slightly) modified CircleCard example that reproduces the behaviour:&lt;BR /&gt;&lt;A href="https://github.com/andrjohns/circleCard-demo" target="_blank"&gt;https://github.com/andrjohns/circleCard-demo&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 11:22:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Formatting-createDataViewWildcardSelector-with/m-p/4066884#M10215</guid>
      <dc:creator>andrjohns</dc:creator>
      <dc:date>2024-07-29T11:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting - createDataViewWildcardSelector with Grouped Data</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Formatting-createDataViewWildcardSelector-with/m-p/4067785#M10218</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/394735"&gt;@andrjohns&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've spent a little while looking at this. Your code looks good to me, and I think it's probably worth checking with MS to see if this is supported or a bug. This repo is a good way for them to quickly confirm if something is wrong, or if there is something else to do to make it work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For groupings, I would expect the &lt;FONT face="courier new,courier"&gt;DataViewValueColumnGroup&lt;/FONT&gt; returned by &lt;FONT face="courier new,courier"&gt;categorical.values.grouped()&lt;/FONT&gt; to contain an &lt;FONT face="courier new,courier"&gt;objects&lt;/FONT&gt; property with the derived conditional formatting values. This does not happen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To show my working,&amp;nbsp;I have downloaded your repo and created a data set that looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dmp_0-1722289009656.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1141100i12D6DC753154A561/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dmp_0-1722289009656.png" alt="dmp_0-1722289009656.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Category = Month Name (Date.Month Name)&lt;/LI&gt;
&lt;LI&gt;Grouping = Calendar Year (Date.Calendar Year)&lt;/LI&gt;
&lt;LI&gt;Measure = Deviation from Reference (&lt;SPAN&gt;Temperature Deviations.Deviation from Reference)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;In my data view metadata, I get what I might expect: one entry for each field I added, then an additional four entries for the intersection of grouping x measure:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dmp_1-1722289179227.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1141101i29256E3E7917035B/image-size/large?v=v2&amp;amp;px=999" role="button" title="dmp_1-1722289179227.png" alt="dmp_1-1722289179227.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Expanding the last entry to confirm groupName of 2024 (last value of Calendar Year):&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dmp_2-1722289246694.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1141102iCA7F32F0579DD58A/image-size/large?v=v2&amp;amp;px=999" role="button" title="dmp_2-1722289246694.png" alt="dmp_2-1722289246694.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As I say, it's not a great example, but should hopefully demonstrate that things are happening as I expect so far.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;When I try to add a measure to the conditional formatting field (we'll do an implicit measure of count of Calendar Year, because we have less entries in 2024 and can check the number is right), the array changes as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dmp_3-1722289571297.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1141103iAADBCAFC98516EC5/image-size/large?v=v2&amp;amp;px=999" role="button" title="dmp_3-1722289571297.png" alt="dmp_3-1722289571297.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hopefully you will see that our array length is now 12 (up from 7). This is:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;One entry for the implicit measure (index #3)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Four additional entries for measure x calendar year (entries #5, #7, #9 and #11)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If we expand the final entry, we can see that it is indeed for &lt;FONT face="courier new,courier"&gt;groupName = 2024&lt;/FONT&gt;, and there is an additional property called &lt;FONT face="courier new,courier"&gt;relatedObjects&lt;/FONT&gt; (which I have also expended for youto show its structure):&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dmp_4-1722289786176.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1141104iE06695DA452BC6FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="dmp_4-1722289786176.png" alt="dmp_4-1722289786176.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You should be able to see that this has &lt;FONT face="courier new,courier"&gt;dataPoint.fontSize&lt;/FONT&gt; in its structure.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, this is not part of the API, so we shouldn't rely on it. We can also see that there is no corresponding derived value in there anyway.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is as much as I could find in the data view (I also downloaded the raw data view to check for occurrences of the fontSize object and it's definitely not there).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, long story short, I'd contact MS at &lt;A href="mailto:pbicvsupport@microsoft.com," target="_blank" rel="noopener"&gt;pbicvsupport@microsoft.com,&lt;/A&gt;&amp;nbsp;to see if they can confirm what is gong wrong here, and if it isn't a bug, what the correct implementation should be for this use case. It would defininitely be useful to provide them with your repo and this thread for reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 23:01:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Formatting-createDataViewWildcardSelector-with/m-p/4067785#M10218</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2024-07-29T23:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting - createDataViewWildcardSelector with Grouped Data</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Formatting-createDataViewWildcardSelector-with/m-p/4068526#M10225</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for taking the time to dive in and investigate, it's much appreciated! Great to hear that it's not just me missing something obvious, I'll contact support and see what they say.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2024 07:18:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Formatting-createDataViewWildcardSelector-with/m-p/4068526#M10225</guid>
      <dc:creator>andrjohns</dc:creator>
      <dc:date>2024-07-30T07:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting - createDataViewWildcardSelector with Grouped Data</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Formatting-createDataViewWildcardSelector-with/m-p/4095313#M10314</link>
      <description>&lt;P&gt;For any that come across this thread in the future, the solution that I found was to use a different kind of 'Wildcard' selector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found that the visuals API defined &lt;A href="https://github.com/microsoft/powerbi-visuals-api/blob/f8aea10abaa3d9120a98befd4d22b66025876c7b/src/visuals-api.d.ts#L843" target="_blank" rel="noopener"&gt;different types of data repetition selectors, specifically a role wildcard&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So where the original implementation was:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    fontSize = new formattingSettings.NumUpDown({
        name: "fontSize",
        displayName: "Text Size",
        value: 12,
        selector: dataViewWildcard.createDataViewWildcardSelector(dataViewWildcard.DataViewWildcardMatchingOption.InstancesAndTotals),
        instanceKind: powerbi.VisualEnumerationInstanceKinds.ConstantOrRule
    });
&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I followed the definition for &lt;A href="https://github.com/microsoft/powerbi-visuals-utils-dataviewutils/blob/874c12cce91f9509e364cac2bd7f6e4a2d4a63f5/src/dataViewWildcard.ts#L41" target="_blank" rel="noopener"&gt;creating the dataview wildcard selector&lt;/A&gt; and replaced the selector definition with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    fontSize = new formattingSettings.NumUpDown({
        name: "fontSize",
        displayName: "Text Size",
        value: 12,
        selector: { data: [{ roles: ["category"] }] },
        instanceKind: powerbi.VisualEnumerationInstanceKinds.ConstantOrRule
    });
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this change, the conditional formatting objects were then bound to 'categories' as before, even when a grouping series is used&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 11:49:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Formatting-createDataViewWildcardSelector-with/m-p/4095313#M10314</guid>
      <dc:creator>andrjohns</dc:creator>
      <dc:date>2024-08-12T11:49:36Z</dc:date>
    </item>
  </channel>
</rss>

