<?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 Script to add a rolling count per dimension over 21 day period with irregular dates in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Script-to-add-a-rolling-count-per-dimension-over-21-day-period/m-p/2035163#M85307</link>
    <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;I have a table in a dashboard that lists trainers and their horses competing in a specific race. In this table I have calculated the number of races each of the horse trainers have won during the preceding 21 day period. This is then the basis for a performance rank. The formula looks like this and works only when I have selected a "T-Date" and a "Race" as I use the GetFieldSelection() in the formula:&amp;nbsp;Aggr(NODISTINCT Count({1&amp;lt;[T-Date]={"&amp;lt;=$(=Date(GetFieldSelections(T-Date)-1,'YYYY-MM-DD'))"}&amp;gt;*1&amp;lt;[T-Date]={"&amp;gt;$(=Date(GetFieldSelections(T-Date)-21,'YYYY-MM-DD'))"}&amp;gt;*1&amp;lt;Placement ={1}&amp;gt;}[Trainer]), [Trainer])&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-02-07 at 16.43.54.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99888iE846CC293CDAAB19/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-02-07 at 16.43.54.png" alt="Screenshot 2023-02-07 at 16.43.54.png" /&gt;&lt;/span&gt;&lt;BR /&gt;What I am struggling with is to add the same calculation in a different table containing all races during 3-4 years (see picture). I understand that this formula is not possible to compute row by row in a chart and therefore I have tried to look for an approach to do it in the script. Right? Here is an example of what I want to be able to achieve: a rolling 21-day count of number of races won by trainer in order to rank their performance for each race; so that I can have this table in a dashboard.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-02-07 at 16.44.07.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99907iE2DCEFAEE0A5F102/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-02-07 at 16.44.07.png" alt="Screenshot 2023-02-07 at 16.44.07.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have looked at rangecount, iterative loads using peek and such things but cannot figure out how to do it without syntax problems or invalid expressions. Anyone who have an idea of how to do it?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 19:44:25 GMT</pubDate>
    <dc:creator>Marcus_Svensson</dc:creator>
    <dc:date>2023-02-07T19:44:25Z</dc:date>
    <item>
      <title>Script to add a rolling count per dimension over 21 day period with irregular dates</title>
      <link>https://community.qlik.com/t5/App-Development/Script-to-add-a-rolling-count-per-dimension-over-21-day-period/m-p/2035163#M85307</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;I have a table in a dashboard that lists trainers and their horses competing in a specific race. In this table I have calculated the number of races each of the horse trainers have won during the preceding 21 day period. This is then the basis for a performance rank. The formula looks like this and works only when I have selected a "T-Date" and a "Race" as I use the GetFieldSelection() in the formula:&amp;nbsp;Aggr(NODISTINCT Count({1&amp;lt;[T-Date]={"&amp;lt;=$(=Date(GetFieldSelections(T-Date)-1,'YYYY-MM-DD'))"}&amp;gt;*1&amp;lt;[T-Date]={"&amp;gt;$(=Date(GetFieldSelections(T-Date)-21,'YYYY-MM-DD'))"}&amp;gt;*1&amp;lt;Placement ={1}&amp;gt;}[Trainer]), [Trainer])&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-02-07 at 16.43.54.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99888iE846CC293CDAAB19/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-02-07 at 16.43.54.png" alt="Screenshot 2023-02-07 at 16.43.54.png" /&gt;&lt;/span&gt;&lt;BR /&gt;What I am struggling with is to add the same calculation in a different table containing all races during 3-4 years (see picture). I understand that this formula is not possible to compute row by row in a chart and therefore I have tried to look for an approach to do it in the script. Right? Here is an example of what I want to be able to achieve: a rolling 21-day count of number of races won by trainer in order to rank their performance for each race; so that I can have this table in a dashboard.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-02-07 at 16.44.07.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99907iE2DCEFAEE0A5F102/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-02-07 at 16.44.07.png" alt="Screenshot 2023-02-07 at 16.44.07.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have looked at rangecount, iterative loads using peek and such things but cannot figure out how to do it without syntax problems or invalid expressions. Anyone who have an idea of how to do it?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 19:44:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-to-add-a-rolling-count-per-dimension-over-21-day-period/m-p/2035163#M85307</guid>
      <dc:creator>Marcus_Svensson</dc:creator>
      <dc:date>2023-02-07T19:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add a rolling count per dimension over 21 day period with irregular dates</title>
      <link>https://community.qlik.com/t5/App-Development/Script-to-add-a-rolling-count-per-dimension-over-21-day-period/m-p/2035325#M85322</link>
      <description>&lt;P&gt;Create an AsOf Table, where each date is associated to previous 21Dates&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;refer below,&amp;nbsp; &amp;nbsp;or post some sample data in excel&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Design/The-As-Of-Table/ba-p/1466130" target="_blank" rel="noopener"&gt;https://community.qlik.com/t5/Design/The-As-Of-Table/ba-p/1466130&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 08:21:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-to-add-a-rolling-count-per-dimension-over-21-day-period/m-p/2035325#M85322</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2023-02-08T08:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add a rolling count per dimension over 21 day period with irregular dates</title>
      <link>https://community.qlik.com/t5/App-Development/Script-to-add-a-rolling-count-per-dimension-over-21-day-period/m-p/2035327#M85323</link>
      <description>&lt;P&gt;row by row evaluation is also possible , but creating an AsOf table is the most performant solution as the prior would be slower in comparison&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 08:23:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-to-add-a-rolling-count-per-dimension-over-21-day-period/m-p/2035327#M85323</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2023-02-08T08:23:17Z</dc:date>
    </item>
  </channel>
</rss>

