<?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: Conditional Distinct Count of Values in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Distinct-Count-of-Values/m-p/4147656#M10546</link>
    <description>&lt;P&gt;Link to pbix file with sample dataset and chart &lt;A href="https://drive.google.com/file/d/1A0atzjFX2Q0DQvOLv9uRtoLM_OJaR_zB/view?usp=sharing" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Sep 2024 15:31:23 GMT</pubDate>
    <dc:creator>sean_cochran</dc:creator>
    <dc:date>2024-09-12T15:31:23Z</dc:date>
    <item>
      <title>Conditional Distinct Count of Values</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Distinct-Count-of-Values/m-p/4145579#M10535</link>
      <description>&lt;P&gt;In a working Deneb visual that displays survey data, I have a relatively flat dataset structured this way:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sean_cochran_2-1726078186567.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1165997i8947353347787972/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sean_cochran_2-1726078186567.png" alt="sean_cochran_2-1726078186567.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When aggregating this data, I want a count of distinct values for "person" - ONLY for rows where "complete" = 0. Also, I do not want to filter the data to achieve this, because I need the filtered rows later for other purposes. My first strategy was to calculate a new column called "distinctPerson" that listed the person column value if "complete" == 1 and showed null otherwise, but the "distinct" count sees 'null' as a distinct value rather than ignoring it. Here is a &lt;A href="https://vega.github.io/editor/#/url/vega-lite/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykBaADZ04JAKyUAVhDYA7EABoQAEySYUqUMSSCGcCGgDaoAApwATjPnoAgopA2IEGmVlxlaAIxKAwmwQ4gnCYcGgADEoASmo0smRosgyCgkoAkrLKcAAeCUkpID5q5GzmAJ65yUoAyhY0+l5KAJpwSOZoAExh7e0AvgqmFlZoIABC9o7Oru4NBf6BwaGo3iDRmLHxqAAsaRnZXu0AzNsFRWQl5egAcnAMmOY69jXmdQZLTS1tqJ3dfQOWcsMxkoJi43B43rMAkEQjNVus0GIdpkcktDoiTiEzmVhgBxNhsDzVWr1CHNVodLq9fogMz-awFcZOUHTCF+KELcJRGJxCr5dLI3m+U7nQUgJ4vDrvclfSm-GmDAHoAAijMmYJmbPmMIhcJ5WyRey+mzEADYhZiRVcbncHkTniT2lLPt8qX8hsrVczwctNdDFstdRtHSB+YbPGjzcVsegRkhCWLia9g2TnbKALp9EA22QQABmJQQRlAUB0UCSRWGqkwDAQlF9CwABABeJsNzwNgD8DarNcotKsDdQDcSyXsSFeKhoEDWsigmH7ALlSDIZHMfG1xhAbBwwwQLXkSlzdUE4JW3PiSnHwxspHuZDggZAcu3wygbAYskwY4nABU2OpBD8D8v2fHd0AgGt7CPOAT2GesYUvCd4PcIDPyfakX3QZQpxnOcoOPU9sOnWI5wXA8QCvdA-wApUcJI+cFRzJ80yUVd3xwJgLkMBN7QMSMsXKDNqUkNhYmXVd10WTdMMnYjZy-Q8COGMjv2GWi5LnZDlDIgwehYkA2IYDiuJ4iV+JFDN9OQcwAGthiYcklDgWcCXhTQQAuUBoNg9BxXqJRMFKHBFi3cxsNkB5MxRLylOVOj5K0nT7EC4LhgARwYJBPzoGJSGSuggjU+K5wbZCGySzM30EEo0BimDT0KC1sQCoKQtkfwxMEJ8eh6IA" target="_self"&gt;link&lt;/A&gt; to the example in the vega editor. As you can see from the chart, "null" values - which are cases where there is no value in the person column because "complete" = 0 - are counted as distinct values:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sean_cochran_4-1726079375629.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1166008i32A68BF6AF451F8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sean_cochran_4-1726079375629.png" alt="sean_cochran_4-1726079375629.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I remove these null values from the count (not the chart, the actual aggregation in the background) &lt;U&gt;without&lt;/U&gt; filtering the dataset to "datum.Completed == 1" since this would remove necessary information for later? I have tried the following concepts without success:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Perform transforms within a lookup (this doesn't seem to work - maybe I'm missing something?)&lt;/LI&gt;&lt;LI&gt;Define and transform an additional data object that references my initial named dataset and join onto original (I haven't figured out a way to get this working)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;If I'm missing something major, please let me know - or if one of the two failed attempts I listed is likely to work, and I'm just using the wrong syntax, let me know and I can provide more info.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/124852"&gt;@giammariam&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UPDATE:&amp;nbsp;&lt;/STRONG&gt; pbix containning the visual and dataset &lt;A href="https://drive.google.com/file/d/1A0atzjFX2Q0DQvOLv9uRtoLM_OJaR_zB/view?usp=sharing" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 16:39:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Distinct-Count-of-Values/m-p/4145579#M10535</guid>
      <dc:creator>sean_cochran</dc:creator>
      <dc:date>2024-09-12T16:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Distinct Count of Values</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Distinct-Count-of-Values/m-p/4147436#M10544</link>
      <description>&lt;P&gt;Can you share the sample dataset?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 14:17:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Distinct-Count-of-Values/m-p/4147436#M10544</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-09-12T14:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Distinct Count of Values</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Distinct-Count-of-Values/m-p/4147656#M10546</link>
      <description>&lt;P&gt;Link to pbix file with sample dataset and chart &lt;A href="https://drive.google.com/file/d/1A0atzjFX2Q0DQvOLv9uRtoLM_OJaR_zB/view?usp=sharing" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 15:31:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Distinct-Count-of-Values/m-p/4147656#M10546</guid>
      <dc:creator>sean_cochran</dc:creator>
      <dc:date>2024-09-12T15:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Distinct Count of Values</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Distinct-Count-of-Values/m-p/4150262#M10563</link>
      <description>&lt;P&gt;I found a simple solution. I used a "missing" op in my aggregation step to detect when null values were present in the data, and then subtracted 1 from the value of a "distinct" aggregation in a later calculate step whenever a null value was present in the series. Sample chart and dataset available at this &lt;A href="https://vega.github.io/editor/#/url/vega-lite/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykBaADZ04JAKyUAVhDYA7EABoQAEySYUqUMSSCGcCGgDaoAApwATjPnoAgopA2IEGmVlxlaAIxKAwmwQ4gnCYcGgADEoASmo0smRosgyCgkoAkrLKcAAeCUkpID5q5GzmAJ65yUoAyhY0+l5KAJpwSOZoAExh7e0AvgqmFlZoIABC9o7Oru4NBf6BwaGo3iDRmLHxqAAsaRnZXu0AzNsFRWQl5egAcnAMmOY69jXmdQZLTS1tqJ3dfQOWcsMxkoJi43B43rMAkEQjNVus0GIdpkcktDoiTiEzmVhgBxNhsDzVWr1CHNVodLq9fogMz-awFcZOUHTCF+KELcJRGJxCr5dLI3m+U7nQUgJ4vDrvclfSm-GmDAHoAAijMmYJmbPmMIhcJ5WyRey+mzEADYhZiRVcbncHkTniT2lLPt8qX8hsrVczwctNdDFstdRtHSB+YbPGjzcVsegRkhCWLia9g2TnbKALp9EA22QQABmJQQRlAUB0UCSRWGqkwDAQlF9CwABABeJsNzwNgD8DarNcotKsDdQDcSyXsSFeKhoEDWsigmH7ALlSDIZHMfG1xhAbBwwwQLXkSlzdUE4JW3PiSnHwxspHuZDggZAcu3wygbAYskwY4nABU2OpBD8D8v2fHd0AgGt7CPOAT2GesYUvCd4PcIDPyfakX3QBAp2cHlD2PU9lCnGc5wXA8QCvdAR0A980NAytiNiOcoIIhjpyY+cFXIyjJ3Y2dOLpAwejTJRV3fHAmAuQwE3tAxIyxcoM2pEtBDLQQK3QHta2o1DMAbAA+Bswk7bs1F7Ii+NIriIAbfg20HUzq1rCySIEqw5IoickDnBgdCVRj+N0p8RJAZBzAAa2GJhySUOBZwJeFNBAC5QGg2D0HFeolEwUocEWLdzCI2QHkzFFUtY9BvOrPyArnILsty-KAEdfM-OgYlIew1kwIJhn8yy9OQhsyKEpQ30EEo0HKmDT0KC1sQavLhlkfxYhKnoeiAA" target="_self"&gt;link&lt;/A&gt; in the Vega editor.&lt;/P&gt;&lt;P&gt;Chart below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sean_cochran_0-1726265049166.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1167431iB5AB7594B26F44F4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sean_cochran_0-1726265049166.png" alt="sean_cochran_0-1726265049166.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 22:05:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Conditional-Distinct-Count-of-Values/m-p/4150262#M10563</guid>
      <dc:creator>sean_cochran</dc:creator>
      <dc:date>2024-09-13T22:05:19Z</dc:date>
    </item>
  </channel>
</rss>

