<?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: Data between two date and time in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558395#M742857</link>
    <description>&lt;P&gt;Hi Check this revised code and output as desired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Data:
LOAD 
Timestamp(GEDATE + GETIME,'DD-MM-YYYY hh:mm:ss') as INTIME,
If(Isnull(Timestamp(GATEOUTDATE + GATEOUTTIME,'DD-MM-YYYY hh:mm:ss')),TimeStamp(Now(),'DD-MM-YYYY hh:mm:ss'),
Timestamp(GATEOUTDATE + GATEOUTTIME,'DD-MM-YYYY hh:mm:ss'))as OUTTIME,
GEDATE, GETIME, GATEENTRYNO, GATENO, GPQTY, GATEOUTDATE, GATEOUTTIME
FROM [Gate In Out.xlsx] (ooxml, embedded labels, table is Sheet1);

Min_Max:
Load Min(INTIME) as vINMin,
     Max(INTIME) as vINMax,
     Min(OUTTIME) as vOUTMin,
     Max(OUTTIME) as vOUTMax
     Resident Data;
     

Let vINMax = Timestamp(Date(Floor(Peek('vINMax')))+ '06:00:00','DD-MM-YYYY hh:mm:ss');

Let vINMin = Timestamp(Date(Floor(Peek('vINMin')))+ '06:00:00','DD-MM-YYYY hh:mm:ss');

Let vOUTMax = Timestamp(Date(Floor(Peek('vOUTMax')))+ '06:00:00','DD-MM-YYYY hh:mm:ss');

Let vOUTMin = Timestamp(Date(Floor(Peek('vOUTMin')))+ '06:00:00','DD-MM-YYYY hh:mm:ss');

Drop table Min_Max;&lt;/PRE&gt;&lt;P&gt;Out put in UI:&lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="Capture.JPG" style="width: 995px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8369i18D2004A064F050A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Mar 2019 11:36:52 GMT</pubDate>
    <dc:creator>HirisH_V7</dc:creator>
    <dc:date>2019-03-19T11:36:52Z</dc:date>
    <item>
      <title>Data between two date and time</title>
      <link>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558214#M742850</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;I've data of vehicle movement which includes gate in &amp;amp; gate out date and time in different fields and requirement is to generate a report how many for vehicle movement how many in and how many out day wise.In my company the day is calculated as from previous day 6AM to next day 6AM.&lt;/P&gt;&lt;P&gt;Can any one guide how to do it? Sample data attached.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 21:13:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558214#M742850</guid>
      <dc:creator>sudhir0538</dc:creator>
      <dc:date>2024-11-16T21:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Data between two date and time</title>
      <link>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558223#M742851</link>
      <description>Which count do you want? GPQTY?</description>
      <pubDate>Tue, 19 Mar 2019 06:48:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558223#M742851</guid>
      <dc:creator>Shubham_Deshmukh</dc:creator>
      <dc:date>2019-03-19T06:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: Data between two date and time</title>
      <link>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558232#M742852</link>
      <description>&lt;P&gt;Try this :&lt;/P&gt;&lt;PRE&gt;=INTERVAL(DATE(GATEOUTDATE+ GATEOUTTIME)-DATE(GEDATE + [GETIME]))&lt;/PRE&gt;&lt;P&gt;OR if you want it to show with minutes, you can add parameter like :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;=INTERVAL(DATE(GATEOUTDATE+ GATEOUTTIME)-DATE(GEDATE + [GETIME]),&lt;STRONG&gt;'mm'&lt;/STRONG&gt;)&lt;/PRE&gt;&lt;P&gt;- Shubham&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 06:57:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558232#M742852</guid>
      <dc:creator>Shubham_Deshmukh</dc:creator>
      <dc:date>2019-03-19T06:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Data between two date and time</title>
      <link>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558242#M742853</link>
      <description>&lt;P&gt;To get the date right you will need to create an master calendar, but your will need to substract six hours from the timestamp when generating your transaction table date key.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example below:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Transactions:
LOAD 
	floor(Timestamp - interval#(6,'h')) as %date , //skew 6 hours
	Timestamp, 
	Animal
INLINE [
Timestamp,Animal
2019-03-06 01:18:29,Common brushtail possum
2019-03-06 03:55:31,Indian leopard
2019-03-06 05:44:54,Netted rock dragon
2019-03-06 06:22:29,Grey mouse lemur
2019-03-06 07:25:58,Javanese cormorant
2019-03-05 10:59:51,"Sandgrouse, yellow-throated"
2019-03-06 05:31:29,"Reedbuck, bohor"
2019-03-06 06:56:49,,Pied crow
2019-03-06 07:26:09,"Booby, blue-footed"
2019-03-05 00:07:22,Komodo dragon
2019-03-05 07:12:26,Common boubou shrike
2019-03-06 06:55:49,"Siskin, pine"
2019-03-06 23:52:16,Thomson's gazelle
];

Calendar:
LOAD 
  num(Date) as %date,
  Date,
  year(Date) as Year,
  Week(Date) as Week,
  Weekday(Date) as Weekday
INLINE [
  Date
  2019-03-06
  2019-03-05
  2019-03-04
];&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Mar 2019 08:32:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558242#M742853</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2019-03-19T08:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Data between two date and time</title>
      <link>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558266#M742854</link>
      <description>&lt;P&gt;Hi Check out this below code,&lt;/P&gt;&lt;PRE&gt;Data:
Load *,
If(Floor(INTIME)=Floor(OUTTIME) and Hour(INTIME)&amp;lt;6,'1 D  ' &amp;amp;  Interval(OUTTIME-INTIME,'hh:mm:ss'),
If(Floor(INTIME)&amp;lt;&amp;gt;Floor(OUTTIME) and Hour(INTIME)&amp;lt;6,Floor(OUTTIME)-Floor(INTIME-1)  &amp;amp;' D ' &amp;amp;  Interval(OUTTIME-INTIME,'hh:mm:ss'),
Floor(OUTTIME)-Floor(INTIME)  &amp;amp;' D ' &amp;amp;  Interval(OUTTIME-INTIME,'hh:mm:ss')))
as Interval_Diff;

LOAD 
Timestamp(GEDATE + GETIME,'DD-MM-YYYY hh:mm:ss') as INTIME,
If(Isnull(Timestamp(GATEOUTDATE + GATEOUTTIME,'DD-MM-YYYY hh:mm:ss')),TimeStamp(Now(),'DD-MM-YYYY hh:mm:ss'),
Timestamp(GATEOUTDATE + GATEOUTTIME,'DD-MM-YYYY hh:mm:ss'))as OUTTIME,
GEDATE, GETIME, GATEENTRYNO, GATENO, GPQTY, GATEOUTDATE, GATEOUTTIME
FROM [Gate In Out.xlsx] (ooxml, embedded labels, table is Sheet1);&lt;/PRE&gt;&lt;P&gt;From the sample data provided, created above. It will give the Interval in time as well as no of days in between. Based on your below 6 and above 6 logic.&lt;/P&gt;&lt;P&gt;If required as calendar means,let me know all occurrences of this. we can use daystart function for such cases.&lt;/P&gt;&lt;P&gt;Anyway, above doesn't work means. let me know your desired output for all the occurrences.&lt;/P&gt;&lt;P&gt;PFA QVW For ref.&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Hirish&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 08:25:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558266#M742854</guid>
      <dc:creator>HirisH_V7</dc:creator>
      <dc:date>2019-03-19T08:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Data between two date and time</title>
      <link>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558332#M742855</link>
      <description>&lt;P&gt;Hi Subham, I want to count how many vehicles are In and How many vehicles are out. Suppose for this day 19.03.2019 we have to count frim 18.03.2019 morning 6AM to 19.03.2019 6AM.&lt;/P&gt;&lt;P&gt;Thank You for suggestions above !!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 09:56:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558332#M742855</guid>
      <dc:creator>sudhir0538</dc:creator>
      <dc:date>2019-03-19T09:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Data between two date and time</title>
      <link>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558333#M742856</link>
      <description>&lt;P&gt;Hi Hirish, I want to count how many vehicles are In and How many vehicles are out. Suppose for this day 19.03.2019 we have to count frim 18.03.2019 morning 6AM to 19.03.2019 6AM.&lt;/P&gt;&lt;P&gt;Please help to get that !! Thank you for all the suggestions !!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 09:57:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558333#M742856</guid>
      <dc:creator>sudhir0538</dc:creator>
      <dc:date>2019-03-19T09:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Data between two date and time</title>
      <link>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558395#M742857</link>
      <description>&lt;P&gt;Hi Check this revised code and output as desired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Data:
LOAD 
Timestamp(GEDATE + GETIME,'DD-MM-YYYY hh:mm:ss') as INTIME,
If(Isnull(Timestamp(GATEOUTDATE + GATEOUTTIME,'DD-MM-YYYY hh:mm:ss')),TimeStamp(Now(),'DD-MM-YYYY hh:mm:ss'),
Timestamp(GATEOUTDATE + GATEOUTTIME,'DD-MM-YYYY hh:mm:ss'))as OUTTIME,
GEDATE, GETIME, GATEENTRYNO, GATENO, GPQTY, GATEOUTDATE, GATEOUTTIME
FROM [Gate In Out.xlsx] (ooxml, embedded labels, table is Sheet1);

Min_Max:
Load Min(INTIME) as vINMin,
     Max(INTIME) as vINMax,
     Min(OUTTIME) as vOUTMin,
     Max(OUTTIME) as vOUTMax
     Resident Data;
     

Let vINMax = Timestamp(Date(Floor(Peek('vINMax')))+ '06:00:00','DD-MM-YYYY hh:mm:ss');

Let vINMin = Timestamp(Date(Floor(Peek('vINMin')))+ '06:00:00','DD-MM-YYYY hh:mm:ss');

Let vOUTMax = Timestamp(Date(Floor(Peek('vOUTMax')))+ '06:00:00','DD-MM-YYYY hh:mm:ss');

Let vOUTMin = Timestamp(Date(Floor(Peek('vOUTMin')))+ '06:00:00','DD-MM-YYYY hh:mm:ss');

Drop table Min_Max;&lt;/PRE&gt;&lt;P&gt;Out put in UI:&lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="Capture.JPG" style="width: 995px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8369i18D2004A064F050A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 11:36:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-between-two-date-and-time/m-p/1558395#M742857</guid>
      <dc:creator>HirisH_V7</dc:creator>
      <dc:date>2019-03-19T11:36:52Z</dc:date>
    </item>
  </channel>
</rss>

