<?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: Filter data with conditions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Filter-data-with-conditions/m-p/1109775#M630869</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Qlik experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone help me out to modify the below expression so that I can filter out the undetected terminals in different zone on the same day?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;=sum(if(([Time in sec]&amp;gt;300 and [Time in sec]&amp;lt;=600 and IN_NETWORK='IN_NETWORK'), 1,0))&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Aug 2016 14:42:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-08-03T14:42:57Z</dc:date>
    <item>
      <title>Filter data with conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Filter-data-with-conditions/m-p/1109774#M630867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Qlikview Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some requirements that I need to process with source and also the processed data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The source table contains several columns, but only a few columns that I'd like to focus.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The interested columns are date, time, network_id, cell_id, region, terminal_name, terminal_SWV, hardware&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN style="font-size: 13.3333px; line-height: 1.5em;"&gt;_status, &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;terminal&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; line-height: 1.5em;"&gt;_lat, terminal_long.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The daily log files contains the information for each terminal roughly every 5 minutes. Thus each line denotes the information of each hardware or terminal every 5 minutes. This includes the status of the hardware or terminal in network every 5 minutes such as &lt;SPAN style="font-size: 13.3333px;"&gt; its status (in network or undetected and how long it has been undetected), where the terminal is located and its region, etc. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to count and identify terminal or hardware that is in network or out of network/undetected for certain period of time (e.g. &amp;lt; 5 minutes, 5-10 minutes, etc.). Unfortunately, the hardware status column is in string and does not really give direct indicator where the data can be easily filtered. So, the strings in the data needs to be processed first. What I have done to do is to convert the text in the column hardware_status to seconds, something like below in the script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hardware_status_table:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date, time, network_id, &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;cell_id, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; region,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; terminal_name, terminal_swv, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;hardware status,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // (UNDETECTED 14 days 10 h 40 min 3 sec)&amp;nbsp;&amp;nbsp; - indicating how long the terminal is out of network&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, 'sec')-3, 2) as second,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, 'min')-3, 2) as minute,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status,&lt;/SPAN&gt; index(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, 'h')-3, 2) as hour,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, 'days')-3, 2) as day,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status,&lt;/SPAN&gt; index(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, 'sec')-3, 2)&amp;gt;0, mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(terminal_age, 'sec')-3, 2),0) +&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(terminal_age, 'min')-3, 2)&amp;gt;0, mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(terminal_age, 'min')-3, 2) * 60, 0) +&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, 'h')-3, 2)&amp;gt;0, mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, 'h')-3, 2) *60 * 60,0) +&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, 'days')-3, 2)&amp;gt;0, mid(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, index(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;, 'days')-3, 2) * 60 * 60 * 24, 0) as[Time in sec],&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (left(&lt;SPAN style="font-size: 13.3333px;"&gt;hardware status&lt;/SPAN&gt;,11) ='(UNDETECTED', 'UNDETECTED', if (left(terminal_age,11)='(IN_NETWORK', 'IN_NETWORK','UNKNOWN')) as IN_NETWORK,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; terminal_lat, terminal_lon, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (previous(terminal_name) &amp;lt;&amp;gt; terminal_name,1,0) as back_in,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timestamp(Floor( Timestamp( date &amp;amp; ' ' &amp;amp; time ,'DD/MM/YYYY hh:mm:ss'),1/288)) as [Time Stamp]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[Source\*.csv]&lt;/P&gt;&lt;P&gt;(txt, codepage is 1252, embedded labels, delimiter is ',', msq)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where wildmatch(terminal_name,'FX*') and date &amp;gt;='20/06/2016';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;store terminal_status_table into filename.qvd(qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created an output with a straight table like the attached and some charts as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="undetected1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/133294_undetected1.png" style="height: 197px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="undetected2.png" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/133295_undetected2.png" style="height: 184px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The dimension is Timestamp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression for the column indicating terminal undetected between 5-10 minutes in the straight table is simply&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum(if(([Time in sec]&amp;gt;300 and [Time in sec]&amp;lt;=600 and IN_NETWORK='IN_NETWORK'), 1,0)) &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Could someone verify if the above script and expression are correct to describe the &lt;/SPAN&gt;requirements. Is there also another simpler way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I found that &lt;STRONG&gt;on the same day&lt;/STRONG&gt; there are many terminals with the same id in different zone show "undetected" but also shows in_network in different zone. which are not expected in the calculation. Example is below.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;hardware_id&lt;/TD&gt;&lt;TD&gt;network_name&lt;/TD&gt;&lt;TD&gt;Region&lt;/TD&gt;&lt;TD&gt;Status&lt;/TD&gt;&lt;TD&gt;Less than 5 Min&lt;/TD&gt;&lt;TD&gt;Less than 10 Min&lt;/TD&gt;&lt;TD&gt;Undetected (sec)&lt;/TD&gt;&lt;TD&gt;In Network (sec)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2016-06-20&lt;/TD&gt;&lt;TD&gt;FX151.1266&lt;/TD&gt;&lt;TD&gt;49145&lt;/TD&gt;&lt;TD&gt;Zone1&lt;/TD&gt;&lt;TD&gt;IN_NETWORK&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2016-06-20&lt;/TD&gt;&lt;TD&gt;FX151.1266&lt;/TD&gt;&lt;TD&gt;49145&lt;/TD&gt;&lt;TD&gt;Zone1&lt;/TD&gt;&lt;TD&gt;UNDETECTED&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;318316&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to calculate availability of total terminals, but need to filter out this type of condition. So the condition is if the same terminals in different zone on the same period (e.g. day or possibly another defined period) shows undetected, then do not include in the calculation. In this case the terminal status may be old and just simply be incorrectly reported as as it moves to different zone, so we need to discard this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to filter this out so that the result of the expression above does not include the undesired condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the right expression for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Aug 2016 11:04:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Filter-data-with-conditions/m-p/1109774#M630867</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-02T11:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Filter data with conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Filter-data-with-conditions/m-p/1109775#M630869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Qlik experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone help me out to modify the below expression so that I can filter out the undetected terminals in different zone on the same day?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;=sum(if(([Time in sec]&amp;gt;300 and [Time in sec]&amp;lt;=600 and IN_NETWORK='IN_NETWORK'), 1,0))&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2016 14:42:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Filter-data-with-conditions/m-p/1109775#M630869</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-03T14:42:57Z</dc:date>
    </item>
  </channel>
</rss>

