<?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: Set Expression Question in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391436#M32034</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant, thankyou!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Nov 2017 04:19:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-29T04:19:16Z</dc:date>
    <item>
      <title>Set Expression Question</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391433#M32031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm still learning set expressions along with aggr, and find myself easily stumped by problems that I think should be easily solved.&amp;nbsp; Having spent the better part of a day on this one &amp;amp; getting nowhere, I thought it best to ask for help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My purely fictitious test dataset is as follows:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shelves:&lt;/P&gt;&lt;P&gt;load * inline [&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;InventoryMonth,&lt;/SPAN&gt;ShelfNumber,Fruit&lt;/P&gt;&lt;P&gt;2,1,Apple&lt;/P&gt;&lt;P&gt;2,1,Orange&lt;/P&gt;&lt;P&gt;2,1,Pear&lt;/P&gt;&lt;P&gt;2,2,Banana&lt;/P&gt;&lt;P&gt;3,1,Apple&lt;/P&gt;&lt;P&gt;3,1,Orange&lt;/P&gt;&lt;P&gt;3,2,Banana&lt;/P&gt;&lt;P&gt;3,3,Apple&lt;/P&gt;&lt;P&gt;3,2,Persimmon&lt;/P&gt;&lt;P&gt;3,2,Pomegranate&lt;/P&gt;&lt;P&gt;3,2,Passionfruit&lt;/P&gt;&lt;P&gt;4,1,Pear&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The chart needs to display the count of shelves that had more than X types of fruit on them during the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say X &amp;gt;= 2.&amp;nbsp; For month=2, only ShelfNumber 1 met that criteria, so the value on the chart should be 1.&amp;nbsp; For month=3, ShelfNumber 1 and 2 both had 2 or more types of fruit, so the chart would show 2.&amp;nbsp; Finally for month=4, the value would be zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried numerous approaches to this, none of which seem to be close to working. I expected a simple solution such as the following to work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count(distinct {&amp;lt;ShelfNumber = {'=count(distinct Fruit) &amp;gt;= 2'}&amp;gt;} ShelfNumber)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... however it returns values of 2, 2, 1 instead of the expected 1, 2, 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance would be much appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 04:05:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391433#M32031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-29T04:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression Question</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391434#M32032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are not just checking the Count(DISTINCT Fruit) against ShelfNumber, but ShelfNumber and InventoryMonth, right? In that case, create a new field in the script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;Shelves:&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="color: #ff0000;"&gt;LOAD AutoNumber(InventoryMonth&amp;amp;ShelfNumber) as Key,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;load * inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;InventoryMonth,&lt;/SPAN&gt;ShelfNumber,Fruit&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;2,1,Apple&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;2,1,Orange&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;2,1,Pear&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;2,2,Banana&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;3,1,Apple&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;3,1,Orange&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;3,2,Banana&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;3,3,Apple&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;3,2,Persimmon&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;3,2,Pomegranate&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;3,2,Passionfruit&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;4,1,Pear&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;and then try this&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;Count(DISTINCT {&amp;lt;Key = {"=Count(DISTINCT Fruit) &amp;gt;= 2"}&amp;gt;} Key)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 04:12:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391434#M32032</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-11-29T04:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression Question</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391435#M32033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alternatively, you can use aggr() function with both ShelfNumber and InventoryNumber to do this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Count(DISTINCT Aggr(If(Count(DISTINCT Fruit) &amp;gt;= 2, ShelfNumber), ShelfNumber, InventoryMonth))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/185022_Capture.PNG" style="height: 145px; width: 620px;" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 04:18:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391435#M32033</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-11-29T04:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression Question</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391436#M32034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant, thankyou!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 04:19:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391436#M32034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-29T04:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression Question</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391437#M32035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that would work as well. I was trying to avoid the use of an IF statement though, as the actual data I'm working with has a huge number of records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 04:20:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391437#M32035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-29T04:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression Question</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391438#M32036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yup, I would go with set analysis any day over the use of Aggr() and if()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 04:21:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Expression-Question/m-p/1391438#M32036</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-11-29T04:21:17Z</dc:date>
    </item>
  </channel>
</rss>

