<?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 Invalid expression while loading the data (calculation working hours between two dates) in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2485890#M101561</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I have a table with following fields:&lt;/P&gt;
&lt;P&gt;TicketID, StartDate and EndDate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have defined 2 variables:&amp;nbsp;set vWorkDayStart = '08:00:00'; set vWorkDayEnd = '16:00:00';&lt;/P&gt;
&lt;P&gt;I have following script:&lt;/P&gt;
&lt;P&gt;mainTable:&lt;/P&gt;
&lt;P&gt;Load&lt;/P&gt;
&lt;P&gt;TicketID,&lt;/P&gt;
&lt;P&gt;IF("New_Date" &amp;gt;= Floor("New_Date") + Time#('$(vWorkDayEnd)', 'hh:mm:ss'), 0, &lt;BR /&gt;Interval(Min("Response Date", Floor("New_Date") + Time#('$(vWorkDayEnd)', 'hh:mm:ss')) &lt;BR /&gt;- Max("New_Date", Floor("New_Date") + Time#('$(vWorkDayStart)', 'hh:mm:ss')), 'hh')) AS FirstDayHours,&lt;BR /&gt;&lt;BR /&gt;IF(Floor("Response Date") &amp;gt; Floor("New_Date") + 1, &lt;BR /&gt;(Floor("Response Date") - Floor("New_Date") - 1) * 8, 0) AS FullDaysHours,&lt;BR /&gt;&lt;BR /&gt;IF(Floor("Response Date") = Floor("New_Date"), 0,&lt;BR /&gt;Interval(Min("Response Date", Floor("Response Date") + Time#('$(vWorkDayEnd)', 'hh:mm:ss')) &lt;BR /&gt;- Floor("Response Date") - Time#('$(vWorkDayStart)', 'hh:mm:ss'), 'hh')) AS LastDayHours&lt;/P&gt;
&lt;P&gt;Resident Table;&lt;/P&gt;
&lt;P&gt;From some reason this is not working, it said that expression is invalid.&lt;/P&gt;
&lt;P&gt;Do you have any insight on this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 16:35:21 GMT</pubDate>
    <dc:creator>LK13</dc:creator>
    <dc:date>2024-11-16T16:35:21Z</dc:date>
    <item>
      <title>Invalid expression while loading the data (calculation working hours between two dates)</title>
      <link>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2485890#M101561</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I have a table with following fields:&lt;/P&gt;
&lt;P&gt;TicketID, StartDate and EndDate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have defined 2 variables:&amp;nbsp;set vWorkDayStart = '08:00:00'; set vWorkDayEnd = '16:00:00';&lt;/P&gt;
&lt;P&gt;I have following script:&lt;/P&gt;
&lt;P&gt;mainTable:&lt;/P&gt;
&lt;P&gt;Load&lt;/P&gt;
&lt;P&gt;TicketID,&lt;/P&gt;
&lt;P&gt;IF("New_Date" &amp;gt;= Floor("New_Date") + Time#('$(vWorkDayEnd)', 'hh:mm:ss'), 0, &lt;BR /&gt;Interval(Min("Response Date", Floor("New_Date") + Time#('$(vWorkDayEnd)', 'hh:mm:ss')) &lt;BR /&gt;- Max("New_Date", Floor("New_Date") + Time#('$(vWorkDayStart)', 'hh:mm:ss')), 'hh')) AS FirstDayHours,&lt;BR /&gt;&lt;BR /&gt;IF(Floor("Response Date") &amp;gt; Floor("New_Date") + 1, &lt;BR /&gt;(Floor("Response Date") - Floor("New_Date") - 1) * 8, 0) AS FullDaysHours,&lt;BR /&gt;&lt;BR /&gt;IF(Floor("Response Date") = Floor("New_Date"), 0,&lt;BR /&gt;Interval(Min("Response Date", Floor("Response Date") + Time#('$(vWorkDayEnd)', 'hh:mm:ss')) &lt;BR /&gt;- Floor("Response Date") - Time#('$(vWorkDayStart)', 'hh:mm:ss'), 'hh')) AS LastDayHours&lt;/P&gt;
&lt;P&gt;Resident Table;&lt;/P&gt;
&lt;P&gt;From some reason this is not working, it said that expression is invalid.&lt;/P&gt;
&lt;P&gt;Do you have any insight on this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 16:35:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2485890#M101561</guid>
      <dc:creator>LK13</dc:creator>
      <dc:date>2024-11-16T16:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid expression while loading the data (calculation working hours between two dates)</title>
      <link>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2485895#M101562</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/315890"&gt;@LK13&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You cannot use Min/Max and other aggregation functions without a Group By.&lt;/P&gt;
&lt;P&gt;One recommendation: create the fields in advance instead of manipulating them inside expressions. This will help you to validate if the columns are getting the correct values.&lt;BR /&gt;Create fields for expressions like:&lt;BR /&gt;&lt;SPAN&gt;Floor("New_Date") + Time#('$(vWorkDayEnd)', 'hh:mm:ss')&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Floor("Response Date")&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Floor("New_Date") + 1&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Floor("Response Date") - Floor("New_Date") - 1) * 8&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Etc, etc&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Mark Costa&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 12:54:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2485895#M101562</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-10-08T12:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid expression while loading the data (calculation working hours between two dates)</title>
      <link>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2486144#M101563</link>
      <description>&lt;P&gt;Hi Mark,&lt;/P&gt;
&lt;P&gt;Thank you for your response.&lt;/P&gt;
&lt;P&gt;I validate data type etc since not working to me. I also tried with RangeSum on front, not working.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any other way how to calculate working hours within defined time 08:00 - 16:00 from Start to End Datetime will be highly appreciated. Below is table representing what final result should be:&lt;/P&gt;
&lt;TABLE width="343"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="111"&gt;Start Time&lt;/TD&gt;
&lt;TD width="111"&gt;End Time&lt;/TD&gt;
&lt;TD width="121"&gt;Result (hh:mm:ss)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;09/10/2024 11:22&lt;/TD&gt;
&lt;TD&gt;09/10/2024 12:22&lt;/TD&gt;
&lt;TD&gt;01:00:00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;09/10/2024 16:22&lt;/TD&gt;
&lt;TD&gt;09/10/2024 10:00&lt;/TD&gt;
&lt;TD&gt;02:00:00&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Timestamp(floor("New_Date")) as Floor_New_Date,&lt;BR /&gt;time('$(vworkdayend)') as WorkDayEnd,&lt;BR /&gt;time('$(vworkdaystart)') as WorkDayStart,&lt;BR /&gt;floor("New_Date") + time#('$(vworkdayend)', 'hh:mm:ss') as End_Of_Workday,&lt;BR /&gt;floor("New_Date") + time#('$(vworkdaystart)', 'hh:mm:ss') as Start_Of_Workday,&lt;BR /&gt;Timestamp(floor("Response Date")) as Floor_Response_Date,&lt;BR /&gt;floor("New_Date") + 1 as New_Date_One,&lt;BR /&gt;(floor("Response Date") - floor("New_Date") - 1) * 8 as Full_Days_Hours&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 09:25:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2486144#M101563</guid>
      <dc:creator>LK13</dc:creator>
      <dc:date>2024-10-09T09:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid expression while loading the data (calculation working hours between two dates)</title>
      <link>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2486229#M101564</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/315890"&gt;@LK13&lt;/a&gt;&amp;nbsp; refer to below post&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/QlikView-Documents/Working-Hours-Calculation-excluding-weekends-and-holidays/ta-p/1477884" target="_blank"&gt;https://community.qlik.com/t5/QlikView-Documents/Working-Hours-Calculation-excluding-weekends-and-holidays/ta-p/1477884&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 14:45:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2486229#M101564</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-10-09T14:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid expression while loading the data (calculation working hours between two dates)</title>
      <link>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2486339#M101565</link>
      <description>&lt;P&gt;Hi Kushal,&lt;/P&gt;
&lt;P&gt;Thank you for your answer. I think I managed to have as expected as per few examples I checked, if there is something wrong i will come back.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 08:37:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Invalid-expression-while-loading-the-data-calculation-working/m-p/2486339#M101565</guid>
      <dc:creator>LK13</dc:creator>
      <dc:date>2024-10-10T08:37:59Z</dc:date>
    </item>
  </channel>
</rss>

