<?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 doing a calculation inline in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/doing-a-calculation-inline/m-p/208753#M64011</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I want to know if there is a way to do a calculation and save it in the script. Its best if I illustrate it, in my script I have:&lt;/P&gt;&lt;P&gt;Date (Today()) - Data ([Date logged]) as [Days since logged]&lt;/P&gt;&lt;P&gt;However I need to use [Days since logged] as a field for an intervalmatch scheme and this requires me to trim the calculation. Sorry this seems confusing, so what in the end I really need is:&lt;/P&gt;&lt;P&gt;Incident:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;//"Date logged",&lt;/P&gt;&lt;P&gt;Date (Today()) - Data ([Date logged]) as [Days since logged] ,&lt;/P&gt;&lt;P&gt;Trim ([Days since logged]),&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;B&gt;Intervalmatch&lt;/B&gt; ([Days since logged])&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;B&gt;Inner&lt;/B&gt; &lt;B&gt;Join&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold; line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;Load&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;[Incident ID],&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 22, '0- 1 Day',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 23, '2 Days',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 24, '3 Days',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 25, '4 Days',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 26, '5 Days',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" &amp;gt; 27 , '5 + days',)))))) &lt;B&gt;as&lt;/B&gt; TimeOpen&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;B&gt;Resident&lt;/B&gt; Incident;&lt;/P&gt;&lt;P&gt;Store Incident Into data/incident.qvd;&lt;/P&gt;&lt;P&gt;Any ideas how I can do this? If anyone could correct my script that would be amazing!&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Jan 2010 13:25:12 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-01-12T13:25:12Z</dc:date>
    <item>
      <title>doing a calculation inline</title>
      <link>https://community.qlik.com/t5/QlikView/doing-a-calculation-inline/m-p/208753#M64011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I want to know if there is a way to do a calculation and save it in the script. Its best if I illustrate it, in my script I have:&lt;/P&gt;&lt;P&gt;Date (Today()) - Data ([Date logged]) as [Days since logged]&lt;/P&gt;&lt;P&gt;However I need to use [Days since logged] as a field for an intervalmatch scheme and this requires me to trim the calculation. Sorry this seems confusing, so what in the end I really need is:&lt;/P&gt;&lt;P&gt;Incident:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;//"Date logged",&lt;/P&gt;&lt;P&gt;Date (Today()) - Data ([Date logged]) as [Days since logged] ,&lt;/P&gt;&lt;P&gt;Trim ([Days since logged]),&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;B&gt;Intervalmatch&lt;/B&gt; ([Days since logged])&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;B&gt;Inner&lt;/B&gt; &lt;B&gt;Join&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold; line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;Load&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;[Incident ID],&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 22, '0- 1 Day',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 23, '2 Days',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 24, '3 Days',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 25, '4 Days',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" = 26, '5 Days',&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;If("Days since logged" &amp;gt; 27 , '5 + days',)))))) &lt;B&gt;as&lt;/B&gt; TimeOpen&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;B&gt;Resident&lt;/B&gt; Incident;&lt;/P&gt;&lt;P&gt;Store Incident Into data/incident.qvd;&lt;/P&gt;&lt;P&gt;Any ideas how I can do this? If anyone could correct my script that would be amazing!&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 13:25:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/doing-a-calculation-inline/m-p/208753#M64011</guid>
      <dc:creator />
      <dc:date>2010-01-12T13:25:12Z</dc:date>
    </item>
    <item>
      <title>doing a calculation inline</title>
      <link>https://community.qlik.com/t5/QlikView/doing-a-calculation-inline/m-p/208754#M64012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looking at the script piece you posted I am not sure why you would need an intervalmatch. Intervalmatch is used to match a date/time with a period that is defined by a start and an end. Or a point between two points (see script below)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Points:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; Point, Value&lt;BR /&gt; 1, 100&lt;BR /&gt; 2, 200&lt;BR /&gt; 3, 150&lt;BR /&gt; 13, 250&lt;BR /&gt; 15, 175&lt;BR /&gt; 22, 800&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;Periods:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; Start, End, Type&lt;BR /&gt; 0, 9, Small&lt;BR /&gt; 10, 19, Middle&lt;BR /&gt; 20, 29, Large];&lt;BR /&gt;&lt;BR /&gt;Temp:&lt;BR /&gt;INTERVALMATCH (Point)&lt;BR /&gt;LOAD Start, End&lt;BR /&gt;RESIDENT Periods;&lt;BR /&gt;&lt;BR /&gt;JOIN (Periods)&lt;BR /&gt;LOAD Start, End, Point&lt;BR /&gt;RESIDENT Temp;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You could probably just do the JOIN without an intervalmatch. But perhaps I misinterpret what you want to do ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 15:12:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/doing-a-calculation-inline/m-p/208754#M64012</guid>
      <dc:creator />
      <dc:date>2010-01-12T15:12:15Z</dc:date>
    </item>
    <item>
      <title>doing a calculation inline</title>
      <link>https://community.qlik.com/t5/QlikView/doing-a-calculation-inline/m-p/208755#M64013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ben,&lt;/P&gt;&lt;P&gt;here a an example without IntervalMatch. Not shure if you need it realy. It depends on your data.&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 15:15:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/doing-a-calculation-inline/m-p/208755#M64013</guid>
      <dc:creator />
      <dc:date>2010-01-12T15:15:55Z</dc:date>
    </item>
  </channel>
</rss>

