<?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: Using count distinct with set analysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524476#M106892</link>
    <description>&lt;P&gt;Looks to be running fine with some sample data I whipped up:&lt;/P&gt;&lt;P&gt;Load * INLINE [&lt;BR /&gt;Year, Type, TransactionID&lt;BR /&gt;2024, A, 1&lt;BR /&gt;2024, A, 2&lt;BR /&gt;2024, B, 1&lt;BR /&gt;2024, B, 3&lt;BR /&gt;2024, C, 3&lt;BR /&gt;2025, A, 3&lt;BR /&gt;2025, B, 3&lt;BR /&gt;2025, B, 4&lt;BR /&gt;2025, C, 5&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Or_0-1752683251640.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182146iAEC570064FBD1519/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Or_0-1752683251640.png" alt="Or_0-1752683251640.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jul 2025 16:28:23 GMT</pubDate>
    <dc:creator>Or</dc:creator>
    <dc:date>2025-07-16T16:28:23Z</dc:date>
    <item>
      <title>Using count distinct with set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524427#M106883</link>
      <description>&lt;P&gt;I have a query around using set analysis with count distinct and have read that this can sometimes not be fully trusted. This happened in my app where the previous year count matched the current year which isn't correct.&lt;/P&gt;&lt;P&gt;What I am hoping to do is calculate the number of distinct transactions but also look at the previous year. This can have outside factors with filtering which I would like to be applicable to the previous year calculation also.&lt;/P&gt;&lt;P&gt;Our transactional data contains multiple lines per transaction to show the line level detail of products, and these also have departments within them that need to apply to set analysis - so I was unable to use a dummy field of '1' for example.&lt;/P&gt;&lt;P&gt;Any help on this would be greatly appreciated, thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 14:02:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524427#M106883</guid>
      <dc:creator>DanielleW1</dc:creator>
      <dc:date>2025-07-16T14:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using count distinct with set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524430#M106884</link>
      <description>&lt;P&gt;You will have to be more specific (ideally with sample data and an expected result), I think. This simply isn't enough concrete information to try and help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 14:13:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524430#M106884</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2025-07-16T14:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using count distinct with set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524443#M106887</link>
      <description>&lt;P&gt;I currently use the following expressions:&lt;/P&gt;&lt;P&gt;COUNT(DISTINCT(({$&amp;lt;Year={'$(&lt;STRONG&gt;vSelectedYear&lt;/STRONG&gt;)'},[Transaction Type]={'RE','SA'}&amp;gt;}[Transaction ID])))&lt;/P&gt;&lt;P&gt;COUNT(DISTINCT(({$&amp;lt;Year={'$(&lt;STRONG&gt;vPrevYear&lt;/STRONG&gt;)'},[Transaction Type]={'RE','SA'}&amp;gt;}[Transaction ID])))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where vSelectedYear = 2025 and vPrevYear = 2024.&lt;/P&gt;&lt;P&gt;This works as expected with the year changes when using a SUM of Sales for example:&lt;/P&gt;&lt;P&gt;SUM(({$&amp;lt;Year={'$(vPrevYear)'},[Transaction Type]={'RE','SA'}&amp;gt;}[Sales Value]))&lt;/P&gt;&lt;P&gt;However both of the COUNT DISTINCT expressions give me the same result.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 14:29:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524443#M106887</guid>
      <dc:creator>DanielleW1</dc:creator>
      <dc:date>2025-07-16T14:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using count distinct with set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524476#M106892</link>
      <description>&lt;P&gt;Looks to be running fine with some sample data I whipped up:&lt;/P&gt;&lt;P&gt;Load * INLINE [&lt;BR /&gt;Year, Type, TransactionID&lt;BR /&gt;2024, A, 1&lt;BR /&gt;2024, A, 2&lt;BR /&gt;2024, B, 1&lt;BR /&gt;2024, B, 3&lt;BR /&gt;2024, C, 3&lt;BR /&gt;2025, A, 3&lt;BR /&gt;2025, B, 3&lt;BR /&gt;2025, B, 4&lt;BR /&gt;2025, C, 5&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Or_0-1752683251640.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182146iAEC570064FBD1519/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Or_0-1752683251640.png" alt="Or_0-1752683251640.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 16:28:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524476#M106892</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2025-07-16T16:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using count distinct with set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524760#M106942</link>
      <description>&lt;P&gt;If [Transaction ID] is a key field, yes it's possible to get some unexpected results depending on how your data model is structured. Recommended to count a non-key field instead.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 04:12:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-count-distinct-with-set-analysis/m-p/2524760#M106942</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2025-07-21T04:12:30Z</dc:date>
    </item>
  </channel>
</rss>

