<?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: Excluding Non operational hours in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2414959#M95008</link>
    <description>&lt;P&gt;According to your calculation, the example should have a total time of 27:10.&lt;/P&gt;
&lt;P&gt;This is how you can calculate it in Qlik using preceding loads for better optimization:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Let vStartTime = Num(MakeTime(6, 0, 0));
Let vEndTime = Num(MakeTime(0, 0, 0)) + 1; // +1 for midnight the next day / 24:00

Data:
NoConcatenate Load
	TicketId,
    Reported,
    Resolved,
    Interval(RangeSum(Days, TimeAfterReported, TimeToResolved), 'hh:mm:ss') as Time;
Load
	*,
    $(vEndTime) - RangeMax(ReportedTime, $(vStartTime)) as TimeAfterReported,
    RangeMin(ResolvedTime, $(vEndTime)) - $(vStartTime) as TimeToResolved
    ;
Load
	*,
    (Floor(Resolved) - Ceil(Reported)) * ($(vEndTime) - $(vStartTime)) as Days,
    Reported - Floor(Reported) as ReportedTime,
    Resolved - Floor(Resolved) as ResolvedTime;
Load
	RecNo() as TicketId,
    Timestamp#(Reported, 'DD/MM/YYYY hh:mm:ss') as Reported,
    Timestamp#(Resolved, 'DD/MM/YYYY hh:mm:ss') as Resolved
Inline [
	Reported, Resolved
	'12/12/2023 19:23:00', '14/12/2023 10:33:00'
];&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This can be reduced if you don't care for the other fields used or the ease of understanding for someone else:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Let vStartTime = Num(MakeTime(6, 0, 0));
Let vEndTime = Num(MakeTime(0, 0, 0)) + 1; // +1 for midnight the next day / 24:00

Data:
NoConcatenate Load
	*,
    Interval(RangeSum(
        (Floor(Resolved) - Ceil(Reported)) * ($(vEndTime) - $(vStartTime)), 
        $(vEndTime) - RangeMax(Reported - Floor(Reported), $(vStartTime)), 
        RangeMin(Resolved - Floor(Resolved), $(vEndTime)) - $(vStartTime)
    ), 'hh:mm:ss') as Time;
Load
	RecNo() as TicketId,
    Timestamp#(Reported, 'DD/MM/YYYY hh:mm:ss') as Reported,
    Timestamp#(Resolved, 'DD/MM/YYYY hh:mm:ss') as Resolved
Inline [
	Reported, Resolved
	'12/12/2023 19:23:00', '14/12/2023 10:33:00'
];&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 05 Feb 2024 15:30:14 GMT</pubDate>
    <dc:creator>LRuCelver</dc:creator>
    <dc:date>2024-02-05T15:30:14Z</dc:date>
    <item>
      <title>Excluding Non operational hours</title>
      <link>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2414894#M95001</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have Ticket reported date='12/12/2023 19:23:00' and Ticket resolved date=' 14/12/2023 10:33:00'&lt;/P&gt;
&lt;P&gt;basically operation hours start from morning 6am to 23:59pm&lt;/P&gt;
&lt;P&gt;if we calculate time difference between will get 35.33hr's between dates. I want to exclude non operational hours which is from 12:01 AM&amp;nbsp; to 5:59 AM hours need to exclude from total hours with respective dates&lt;/P&gt;
&lt;P&gt;Example: from reported date 37min+4 hours=4:37hr's&lt;/P&gt;
&lt;P&gt;13/12/2023 have 24hr's operational hours=18&lt;/P&gt;
&lt;P&gt;14/12/2023 have 10:33hr- 6hrs non operational hrs(12:01 AM&amp;nbsp; to 5:59 AM)=4:33hrs&lt;/P&gt;
&lt;P&gt;finally total operational hours b/w dates=26.7 hr's&lt;/P&gt;
&lt;P&gt;pls help me how can i achieve this in qliksense&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 21:04:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2414894#M95001</guid>
      <dc:creator>praveensai491</dc:creator>
      <dc:date>2024-11-15T21:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding Non operational hours</title>
      <link>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2414959#M95008</link>
      <description>&lt;P&gt;According to your calculation, the example should have a total time of 27:10.&lt;/P&gt;
&lt;P&gt;This is how you can calculate it in Qlik using preceding loads for better optimization:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Let vStartTime = Num(MakeTime(6, 0, 0));
Let vEndTime = Num(MakeTime(0, 0, 0)) + 1; // +1 for midnight the next day / 24:00

Data:
NoConcatenate Load
	TicketId,
    Reported,
    Resolved,
    Interval(RangeSum(Days, TimeAfterReported, TimeToResolved), 'hh:mm:ss') as Time;
Load
	*,
    $(vEndTime) - RangeMax(ReportedTime, $(vStartTime)) as TimeAfterReported,
    RangeMin(ResolvedTime, $(vEndTime)) - $(vStartTime) as TimeToResolved
    ;
Load
	*,
    (Floor(Resolved) - Ceil(Reported)) * ($(vEndTime) - $(vStartTime)) as Days,
    Reported - Floor(Reported) as ReportedTime,
    Resolved - Floor(Resolved) as ResolvedTime;
Load
	RecNo() as TicketId,
    Timestamp#(Reported, 'DD/MM/YYYY hh:mm:ss') as Reported,
    Timestamp#(Resolved, 'DD/MM/YYYY hh:mm:ss') as Resolved
Inline [
	Reported, Resolved
	'12/12/2023 19:23:00', '14/12/2023 10:33:00'
];&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This can be reduced if you don't care for the other fields used or the ease of understanding for someone else:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Let vStartTime = Num(MakeTime(6, 0, 0));
Let vEndTime = Num(MakeTime(0, 0, 0)) + 1; // +1 for midnight the next day / 24:00

Data:
NoConcatenate Load
	*,
    Interval(RangeSum(
        (Floor(Resolved) - Ceil(Reported)) * ($(vEndTime) - $(vStartTime)), 
        $(vEndTime) - RangeMax(Reported - Floor(Reported), $(vStartTime)), 
        RangeMin(Resolved - Floor(Resolved), $(vEndTime)) - $(vStartTime)
    ), 'hh:mm:ss') as Time;
Load
	RecNo() as TicketId,
    Timestamp#(Reported, 'DD/MM/YYYY hh:mm:ss') as Reported,
    Timestamp#(Resolved, 'DD/MM/YYYY hh:mm:ss') as Resolved
Inline [
	Reported, Resolved
	'12/12/2023 19:23:00', '14/12/2023 10:33:00'
];&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 05 Feb 2024 15:30:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2414959#M95008</guid>
      <dc:creator>LRuCelver</dc:creator>
      <dc:date>2024-02-05T15:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding Non operational hours</title>
      <link>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2415970#M95135</link>
      <description>&lt;P&gt;Hi LRuCelver,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the solution you provide. which you provided sample data working perfect but when i replaced inline load with the real data from excel or database it populating same result of time for all records.&lt;/P&gt;
&lt;P&gt;For your reference attaching the scre&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Test.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/159286iC1BD8491A3047F55/image-size/large?v=v2&amp;amp;px=999" role="button" title="Test.png" alt="Test.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Test_Excel data.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/159287iFF177E82BCDD7370/image-size/large?v=v2&amp;amp;px=999" role="button" title="Test_Excel data.png" alt="Test_Excel data.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Test_Excel Script.png" style="width: 895px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/159289iC121907238E06F76/image-size/large?v=v2&amp;amp;px=999" role="button" title="Test_Excel Script.png" alt="Test_Excel Script.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Test_inline.png" style="width: 811px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/159288iF587F5E322664925/image-size/large?v=v2&amp;amp;px=999" role="button" title="Test_inline.png" alt="Test_inline.png" /&gt;&lt;/span&gt;enshots.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 12:12:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2415970#M95135</guid>
      <dc:creator>praveensai491</dc:creator>
      <dc:date>2024-02-07T12:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding Non operational hours</title>
      <link>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2416093#M95144</link>
      <description>&lt;P&gt;Your fields appear to already be formatted as a timestamp. You thus don't need the first step of transforming the texts loaded with the inline load to timestamps.&lt;/P&gt;
&lt;P&gt;I couldn't test it, but try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Let vStartTime = Num(MakeTime(6, 0, 0));
Let vEndTime = Num(MakeTime(0, 0, 0)) + 1; // +1 for midnight the next day / 24:00

Data:
NoConcatenate Load
	"SR Reportdate",
    "Work Order Completion Date",
    Interval(RangeSum(
        (Floor("Work Order Completion Date") - Ceil("SR Reportdate")) * ($(vEndTime) - $(vStartTime)), 
        $(vEndTime) - RangeMax("SR Reportdate" - Floor("SR Reportdate"), $(vStartTime)), 
        RangeMin("Work Order Completion Date" - Floor("Work Order Completion Date"), $(vEndTime)) - $(vStartTime)
    ), 'hh:mm:ss') as Time
From [lib://AttachedFiles/Test data.xlsx]
(ooxml, embedded labels, table is Sheet2);&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Feb 2024 15:09:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2416093#M95144</guid>
      <dc:creator>LRuCelver</dc:creator>
      <dc:date>2024-02-07T15:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding Non operational hours</title>
      <link>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2449059#M97846</link>
      <description>&lt;P&gt;Hi Celver,&lt;/P&gt;
&lt;P&gt;I have 3 tables actualstop,temprature and trip. these 3 tables connected by common field as trid_id.&lt;/P&gt;
&lt;P&gt;in temprature table have fields timestamp,treatmentdate,temp_Car1,temp_Car2 wt i need is wn temprature in any one car more than 25 for the respective row see timestamp after that wr it normalizing temp means below25 we need to caculate time diff of two timestamps and sum all the duration.for more clarification im adding excel below.please suggest how to achieve solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="praveensai491_1-1714975685159.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/165485i01F16321A0F54576/image-size/medium?v=v2&amp;amp;px=400" role="button" title="praveensai491_1-1714975685159.png" alt="praveensai491_1-1714975685159.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;ex: temp more at car2 at 1st row&amp;nbsp; timestamp=4/22/2024 4:03:12 PM&lt;/P&gt;
&lt;P&gt;normalize at second row timestamp=4/22/2024 4:05:24 PM out will be=2.02min&lt;/P&gt;
&lt;P&gt;same follows other calculations&lt;/P&gt;
&lt;P&gt;script:&lt;/P&gt;
&lt;DIV&gt;Actualstop:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; ACTUAL_TIME,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; TRIP_ID&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;FROM [lib://AttachedFiles/BACSATS_20240422.xlsx]&lt;/DIV&gt;
&lt;DIV&gt;(ooxml, embedded labels, table is actual_stops)where WildMatch(TRIP_ID,'2G12A1*','2G12B2*','2G12C2*','2G12C3*',&lt;/DIV&gt;
&lt;DIV&gt;'2G12E1*','2F12A1*','2F12B2*','2F12C2*','2F12C3*','2F12E1*','2E12A1*','2E12B2*','2E12C2*','2E12C3*','2C32A1*',&lt;/DIV&gt;
&lt;DIV&gt;'2C32B2*','2C32C2*','2C22A1*','2C22B2*','2A12G1*','2A12B2*','2A12C2*','2A12C3*','2A12E1*','2A12F1*','2B22C2*','2B22C3*',&lt;/DIV&gt;
&lt;DIV&gt;'2B22E1*','2B22F1*','2B22G1*','2C22C3*','2C22E1*','2C22F1*','2C22G1*','2C32E1*','2C32F1*','2C32G1*','2E22F1*','2E22G1*'&lt;/DIV&gt;
&lt;DIV&gt;);&lt;/DIV&gt;
&lt;DIV&gt;left join(Actualstop)&lt;/DIV&gt;
&lt;DIV&gt;//Concatenate&lt;/DIV&gt;
&lt;DIV&gt;Trip:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; timestamp(TREATMENT_DATE) as Trip_TREATMENT_DATE,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; TRIP_ID,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; TRIP_TYPE&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;FROM [lib://AttachedFiles/BACSATS_20240422.xlsx]&lt;/DIV&gt;
&lt;DIV&gt;(ooxml, embedded labels, table is trip)where TRIP_TYPE='revenue' and WildMatch(TRIP_ID,'2G12A1*','2G12B2*','2G12C2*','2G12C3*',&lt;/DIV&gt;
&lt;DIV&gt;'2G12E1*','2F12A1*','2F12B2*','2F12C2*','2F12C3*','2F12E1*','2E12A1*','2E12B2*','2E12C2*','2E12C3*','2C32A1*',&lt;/DIV&gt;
&lt;DIV&gt;'2C32B2*','2C32C2*','2C22A1*','2C22B2*','2A12G1*','2A12B2*','2A12C2*','2A12C3*','2A12E1*','2A12F1*','2B22C2*','2B22C3*',&lt;/DIV&gt;
&lt;DIV&gt;'2B22E1*','2B22F1*','2B22G1*','2C22C3*','2C22E1*','2C22F1*','2C22G1*','2C32E1*','2C32F1*','2C32G1*','2E22F1*','2E22G1*'&lt;/DIV&gt;
&lt;DIV&gt;);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;left join(Actualstop)&lt;/DIV&gt;
&lt;DIV&gt;TrainEnv:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;LOAD distinct TRIP_ID,&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; RowNo() as Rownum,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; TREATMENT_DATE as Temp_TREATMENT_DATE,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; day(TREATMENT_DATE)as Date,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; date(monthstart(TREATMENT_DATE),'MMM-YY') as A4period,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; timestamp("TIMESTAMP") as Temp_TIMESTAMP,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; hour(Timestamp("TIMESTAMP",'hh:mm:ss')) as TimeST,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; TRAIN_ID,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; TEMP_CAR_1,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; TEMP_CAR_2,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; if(TEMP_CAR_1&amp;gt;=25 or TEMP_CAR_2&amp;gt;=25,1,0) as result&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;FROM [lib://AttachedFiles/BACSATS_20240422.xlsx]&lt;/DIV&gt;
&lt;DIV&gt;(ooxml, embedded labels, table is temperature) where WildMatch(TRIP_ID,'2G12A1*','2G12B2*','2G12C2*','2G12C3*',&lt;/DIV&gt;
&lt;DIV&gt;'2G12E1*','2F12A1*','2F12B2*','2F12C2*','2F12C3*','2F12E1*','2E12A1*','2E12B2*','2E12C2*','2E12C3*','2C32A1*',&lt;/DIV&gt;
&lt;DIV&gt;'2C32B2*','2C32C2*','2C22A1*','2C22B2*','2A12G1*','2A12B2*','2A12C2*','2A12C3*','2A12E1*','2A12F1*','2B22C2*','2B22C3*',&lt;/DIV&gt;
&lt;DIV&gt;'2B22E1*','2B22F1*','2B22G1*','2C22C3*','2C22E1*','2C22F1*','2C22G1*','2C32E1*','2C32F1*','2C32G1*','2E22F1*','2E22G1*'&lt;/DIV&gt;
&lt;DIV&gt;) ;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 06:12:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2449059#M97846</guid>
      <dc:creator>praveensai491</dc:creator>
      <dc:date>2024-05-06T06:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding Non operational hours</title>
      <link>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2449236#M97851</link>
      <description>&lt;P&gt;could anyone pls help scenario which i posted above&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 11:02:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Excluding-Non-operational-hours/m-p/2449236#M97851</guid>
      <dc:creator>praveensai491</dc:creator>
      <dc:date>2024-05-06T11:02:46Z</dc:date>
    </item>
  </channel>
</rss>

