<?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: Count first sorted value based on additional selection in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652744#M447966</link>
    <description>&lt;P&gt;A version of the app.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Nov 2019 15:05:37 GMT</pubDate>
    <dc:creator>peterderrington</dc:creator>
    <dc:date>2019-11-29T15:05:37Z</dc:date>
    <item>
      <title>Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652682#M447961</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having some difficulties getting the syntax right for something i'm trying to calculate.&lt;/P&gt;&lt;P&gt;One of my graphs displays the first instance that something occurs within a particular location - i currently choose that location as a filter.&lt;/P&gt;&lt;P&gt;However i am now in the position whereby i need to both add another filter and count the instances but i don't want to have to do that by selecting the filter but rather build it in to the original expression.&lt;/P&gt;&lt;P&gt;My original expression is:&lt;/P&gt;&lt;P&gt;//Time(FirstSortedValue(DISTINCT [Sent for Time],ID,1))&lt;/P&gt;&lt;P&gt;But i now need it to count the same first sorted value but only if the field '[Session(1=AM 2=PM 3=Eve)]' is equal to '1' and if it started before 09:01:00&lt;/P&gt;&lt;P&gt;Can anyone help.&lt;/P&gt;&lt;P&gt;The closest I've got is:&lt;/P&gt;&lt;P&gt;Count(FirstSortedValue(DISTINCT{&amp;lt;[Session(1=AM 2=PM 3=Eve)]={'1'}&amp;gt;}[Sent for Time]&amp;lt;='00:09:00',ID,1))&lt;/P&gt;&lt;P&gt;but the expression is clearly wrong.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Nov 2019 12:38:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652682#M447961</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-11-29T12:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652704#M447962</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Try something like&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Count(FirstSortedValue(DISTINCT{&amp;lt;[Session(1=AM 2=PM 3=Eve)]={'1'}, [Sent for Time] = {"&amp;lt;=$(=Time('09:00'))"}&amp;gt;}[Sent for Time],ID,1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Where I sopposed that your field&amp;nbsp;[Sent for Time] is properly interpreted as a "time" field with format 'HH:MM:SS'. If it does not work, please try to share a sample APP so we can test (with dates and times and so on there is often errors in interpretation or formats)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Jaime.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Nov 2019 13:50:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652704#M447962</guid>
      <dc:creator>jaibau1993</dc:creator>
      <dc:date>2019-11-29T13:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652735#M447965</link>
      <description>&lt;P&gt;Hi Jamie,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for getting back so quickly. Unfortunately that doesn't seem to work, i imagine that you're right and its probably a formatting issue that's stopping it from working.&lt;/P&gt;&lt;P&gt;I'll look to create a version i can upload so you can see it. at the moment its just a simple straight chart so i can see if the calculations work (the count would either return a 1 or 0 as i'm concentrating on one location), ultimately it may look more like a run chart or similar so i can see how often over the weeks / months they run to schedule.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Nov 2019 14:38:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652735#M447965</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-11-29T14:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652744#M447966</link>
      <description>&lt;P&gt;A version of the app.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Nov 2019 15:05:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652744#M447966</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-11-29T15:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652962#M447975</link>
      <description>&lt;P&gt;Hi Peter!&lt;/P&gt;&lt;P&gt;Thanks for the test APP. I realized that I made a mistaked when I copy-pasted your expression to suggest you a solution. Please, try the following, it works on the test app:&lt;/P&gt;&lt;P&gt;Time(FirstSortedValue(Distinct {&amp;lt;[Session(1=AM 2=PM 3=Eve)]={'1'}, [Sent for Time] = {"&amp;gt;9:00"}&amp;gt;}[Sent for Time],ID,1))&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jaime.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 07:52:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1652962#M447975</guid>
      <dc:creator>jaibau1993</dc:creator>
      <dc:date>2019-12-02T07:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654333#M448052</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the delay - Sickness!&lt;/P&gt;&lt;P&gt;That expression does work for identifying the first instance under a '1' condition which is great but i need to be able to count the instances; a 1 for if it conforms to the condition, 0 if not. The idea being so i can state how often that condition is met over a period of time.&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 20:42:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654333#M448052</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-12-04T20:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654424#M448063</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Okey, I did not understand what you were trying to achieve. Just use a Count function and maintain the set expression:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Count({&amp;lt;[Session(1=AM 2=PM 3=Eve)]={'1'}, [Sent for Time] = {"&amp;gt;9:00"}&amp;gt;} [Sent for Time])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jaime.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 07:32:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654424#M448063</guid>
      <dc:creator>jaibau1993</dc:creator>
      <dc:date>2019-12-05T07:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654466#M448066</link>
      <description>&lt;P&gt;Fantastic, thank you!&lt;/P&gt;&lt;P&gt;Its working perfectly now and i have an extra expression that i hadn't even realised that i needed so its a double win.&lt;/P&gt;&lt;P&gt;Thank You!!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 09:22:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654466#M448066</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-12-05T09:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654469#M448067</link>
      <description>&lt;P&gt;This is probably unlikely but is it possible to get it to return a 'Yes' / 'No' on the count, eg 'No' if it counts '0' and 'Yes' if it counts a '1'+ ?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 09:33:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654469#M448067</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-12-05T09:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654474#M448068</link>
      <description>&lt;P&gt;Yes, of course you can. Try something as the following:&lt;/P&gt;&lt;P&gt;if(&amp;nbsp;&lt;SPAN&gt;Count({&amp;lt;[Session(1=AM 2=PM 3=Eve)]={'1'}, [Sent for Time] = {"&amp;gt;9:00"}&amp;gt;} [Sent for Time]), 'Yes', 'No')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Jaime.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 09:40:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654474#M448068</guid>
      <dc:creator>jaibau1993</dc:creator>
      <dc:date>2019-12-05T09:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654769#M448099</link>
      <description>&lt;P&gt;Fabulous, Thank you, just need to have a play about to see if i can manage to create a graph (ideally a sort of Run Chart) to display that yes/no response over time&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 19:56:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654769#M448099</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-12-05T19:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654789#M448101</link>
      <description>&lt;P&gt;think i'll have to start a new thread really but.....&lt;/P&gt;&lt;P&gt;I can only display anything in a Straight chart for this yes/no data, there isn't a dimension that is relevant i.e. yes/no to allow it to display anything in a pie chart or similar, any quick suggestions before i start a new thread?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 21:30:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1654789#M448101</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-12-05T21:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655337#M448192</link>
      <description>&lt;P&gt;Hi Peter! sorry for the delay, last friday was holiday here in Spain &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am not sure about what kind of visualization you'd want to build. You can create really complex 'calculated dimensions' for your charts but, maybe I am wrong, I think you are looking for something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Example.png" style="width: 891px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/25146i3F17418DA65B170E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Example.png" alt="Example.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Summarizing: yes, i think you can do what you need but we'll need more details.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jaime.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 07:55:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655337#M448192</guid>
      <dc:creator>jaibau1993</dc:creator>
      <dc:date>2019-12-09T07:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655355#M448193</link>
      <description>&lt;P&gt;The image on the left is one of the types of image I'm trying to create but I just cant think how to do it - I'm blaming this cold! &lt;span class="lia-unicode-emoji" title=":monkey_face:"&gt;🐵&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 09:20:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655355#M448193</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-12-09T09:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655389#M448195</link>
      <description>&lt;P&gt;Hi Peter!&lt;/P&gt;&lt;P&gt;To build that chart you need to create a peculiar expression. As you may have noticed, the expression contains two calculations:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;A label: yes or no (given some conditions)&lt;/LI&gt;&lt;LI&gt;A number: what specifies the heigh for each month&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This can be done using "Dual" function. It takes two arguments: a text and a number. Thus, your expression should look like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dual(
     //Yes/No label:
     if(Count({&amp;lt;[Session(1=AM 2=PM 3=Eve)]={'1'}, [Sent for Time] = {"&amp;gt;9:00"}&amp;gt;} [Sent for Time]), 'Yes', 'No')
,
     //The numeric value (I'm guessing it)
     Count({&amp;lt;[Session(1=AM 2=PM 3=Eve)]={'1'}, [Sent for Time] = {"&amp;gt;9:00"}&amp;gt;} [Sent for Time])
)&lt;/LI-CODE&gt;&lt;P&gt;Do not forget to check the "Values on Data Points" checkbox in the expression tab!&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jaime.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 11:05:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655389#M448195</guid>
      <dc:creator>jaibau1993</dc:creator>
      <dc:date>2019-12-09T11:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655516#M448203</link>
      <description>&lt;P&gt;Hi Jamie,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for all your time, I'm struggling to get it to show anything like your diagram.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've set it as a Pie Chart but there's no dimension (I know sometimes with Pie Charts I've not needed a dimension before but I'm not sure if that fits with this).&lt;/P&gt;&lt;P&gt;I've slightly altered the script (just because we had the less than/greater than symbol the wrong way round however the chart just shows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="count.jpeg" style="width: 446px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/25175i26F46BA4332123C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="count.jpeg" alt="count.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;I tried changing it to a straight chart just so I could see what count it was showing but it just shows "Yes"&lt;/P&gt;&lt;P&gt;The current expression is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dual(if( Count({&amp;lt;[Session(1=AM 2=PM 3=Eve)]={'1'}, [Sent for Time] = {"&amp;lt;9:00"}&amp;gt;} [Sent for Time]), 'Yes', 'No'),( Count({&amp;lt;[Session(1=AM 2=PM 3=Eve)]={'1'}, [Sent for Time] = {"&amp;lt;9:00"}&amp;gt;} [Sent for Time])))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that individually the expressions work, feeling lost - sorry.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 15:13:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655516#M448203</guid>
      <dc:creator>peterderrington</dc:creator>
      <dc:date>2019-12-09T15:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Count first sorted value based on additional selection</title>
      <link>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655534#M448207</link>
      <description>&lt;P&gt;Hi Peter!&lt;/P&gt;&lt;P&gt;Just forget what I said, I misunderstood you again!&lt;/P&gt;&lt;P&gt;You need to create a 'calculated' dimension from the 'simple' dimension&amp;nbsp;[Sent for Time]. For each value of [Sent for Time] :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;if&amp;nbsp;[Session(1=AM 2=PM 3=Eve)] = 1 and &amp;gt;9:00 then you have to label it as 'Yes'&lt;/LI&gt;&lt;LI&gt;if&amp;nbsp;[Session(1=AM 2=PM 3=Eve)] = 1 and &amp;lt;=9:00 then you have to label it as 'No'&lt;/LI&gt;&lt;LI&gt;if&amp;nbsp;[Session(1=AM 2=PM 3=Eve)] &amp;lt;&amp;gt; 1 you want to discard it (is this right?)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You can do it using AGGR in a calculated dimension. Just check the attached file and ispect how I built the figures below!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="example.png" style="width: 920px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/25182i7A4FA99215AAC9EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="example.png" alt="example.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know any doubt!&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jaime.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 15:36:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-first-sorted-value-based-on-additional-selection/m-p/1655534#M448207</guid>
      <dc:creator>jaibau1993</dc:creator>
      <dc:date>2019-12-09T15:36:45Z</dc:date>
    </item>
  </channel>
</rss>

