<?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 Calculation based on the latest file without deleting duplicates in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984231#M81212</link>
    <description>&lt;P&gt;Hello community members,&lt;/P&gt;
&lt;P&gt;I am stuck on a very problem where I need to change the calculation based on the specific question. I have a use case where we upload a new file with the same structure to Qlik Sense every hour. Those files contain a&amp;nbsp;dedicated field "intervall" with this format "DD.MM.YYYY hh:mm". This field shows the time the file was created. Now I want to create three different charts that show the following things:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a) Number of transports within the latest file: I figured out how that works and I use the following formula:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;COUNT({&amp;lt;&amp;nbsp;[intervall] = {"$(=TimeStamp(Max(TimeStamp#([intervall], 'DD.MM.YYYY hh:mm')), 'DD.MM.YYYY hh:mm'))"}&amp;gt;} transportid)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;b) Number of transports for each weekday: Therefore I need to pick the latest file for each weekday (e.g. Monday at 11:59pm, Tuesday at 11:59 pm, ...) and then count the transportid's as shown in case a. The problem is, that I tried out a couple of things using an adjusted formula but I cannot get it to work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;c) Number of transports with in the last four weeks: Therefore I need to pick the latest file (e.g. Friday at 11:59 pm) for each week. Same as in case b: I tried out multiple thinks but I guess it is to komplex for me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope someone can help me with this problem and help me loosen the knot in my brain &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
    <pubDate>Thu, 22 Sep 2022 12:23:53 GMT</pubDate>
    <dc:creator>vkal12</dc:creator>
    <dc:date>2022-09-22T12:23:53Z</dc:date>
    <item>
      <title>Calculation based on the latest file without deleting duplicates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984231#M81212</link>
      <description>&lt;P&gt;Hello community members,&lt;/P&gt;
&lt;P&gt;I am stuck on a very problem where I need to change the calculation based on the specific question. I have a use case where we upload a new file with the same structure to Qlik Sense every hour. Those files contain a&amp;nbsp;dedicated field "intervall" with this format "DD.MM.YYYY hh:mm". This field shows the time the file was created. Now I want to create three different charts that show the following things:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a) Number of transports within the latest file: I figured out how that works and I use the following formula:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;COUNT({&amp;lt;&amp;nbsp;[intervall] = {"$(=TimeStamp(Max(TimeStamp#([intervall], 'DD.MM.YYYY hh:mm')), 'DD.MM.YYYY hh:mm'))"}&amp;gt;} transportid)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;b) Number of transports for each weekday: Therefore I need to pick the latest file for each weekday (e.g. Monday at 11:59pm, Tuesday at 11:59 pm, ...) and then count the transportid's as shown in case a. The problem is, that I tried out a couple of things using an adjusted formula but I cannot get it to work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;c) Number of transports with in the last four weeks: Therefore I need to pick the latest file (e.g. Friday at 11:59 pm) for each week. Same as in case b: I tried out multiple thinks but I guess it is to komplex for me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope someone can help me with this problem and help me loosen the knot in my brain &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 12:23:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984231#M81212</guid>
      <dc:creator>vkal12</dc:creator>
      <dc:date>2022-09-22T12:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on the latest file without deleting duplicates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984465#M81224</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;for b, you can try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;COUNT({&amp;lt; [intervall] = {"=weekday(intervall)&amp;gt;=1"} * {"=weekday(intervall)&amp;lt;=5"} * {"=hour(intervall)=23"}&amp;gt;} transportid)&lt;/LI-CODE&gt;
&lt;P&gt;assuming there is a file generated at 11 pm everyday.&lt;/P&gt;
&lt;P&gt;for c, you can try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;COUNT({&amp;lt; [intervall] = {"=weekday(intervall)=5"} * {"=hour(intervall)=23"} * {"=floor(intervall)&amp;gt;=today()-28"}&amp;gt;} transportid)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;assuming there is a file generated at 11 pm everyday.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 20:27:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984465#M81224</guid>
      <dc:creator>SerhanKaraer</dc:creator>
      <dc:date>2022-09-22T20:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on the latest file without deleting duplicates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984517#M81231</link>
      <description>&lt;P&gt;Hi SerhanKaraer,&lt;/P&gt;
&lt;P&gt;thanks for your response! There will be definitely be a file generated at 11pm every day. But the dashboard gets updated every hour as well so that it is not possible to put an absolute number in that formular. For e.g. now it is 07:54 am and the last file ist from 07:00 am so that the calculation should be based on the latest file which will be from 07:00 am.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the past days the latest file is always from 11pm but not for the current day. How can I include that in your suggested formula?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I extracted a new field from my field "intervall" which shows the hour, e.g. 1, 2, 3 and so on. From hat new filed I basically need to extract the max value and use that for my calculation. But this does not seem to work...&lt;/P&gt;
&lt;P&gt;=COUNT({&amp;lt; [intervall] = {"$(=max([intervall]))"} &amp;gt;} transportid)&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Vanessa&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 06:00:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984517#M81231</guid>
      <dc:creator>vkal12</dc:creator>
      <dc:date>2022-09-23T06:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on the latest file without deleting duplicates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984538#M81233</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;It is good to hear that you can manipulate data model in script. You had better create a date of intervall field like&amp;nbsp;&lt;STRONG&gt;date(floor(intervall)) as intervall_date.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Then for b, you can try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;COUNT({&amp;lt; [intervall] = {"=weekday(intervall)&amp;gt;=1"} * {"=weekday(intervall)&amp;lt;=5"} * {"=intervall=aggr(max(total &amp;lt;intervall_date&amp;gt; intervall),intervall_date)"}&amp;gt;} transportid)&lt;/LI-CODE&gt;
&lt;P&gt;Then for c, you can try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;COUNT({&amp;lt; [intervall] = {"=weekday(intervall)=5"} * {"=intervall=aggr(max(total &amp;lt;intervall_date&amp;gt; intervall),intervall_date)"} * {"=intervall_date&amp;gt;=today()-28"}&amp;gt;} transportid)&lt;/LI-CODE&gt;
&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 06:56:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984538#M81233</guid>
      <dc:creator>SerhanKaraer</dc:creator>
      <dc:date>2022-09-23T06:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on the latest file without deleting duplicates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984593#M81244</link>
      <description>&lt;P&gt;Hi SerhanKaraer,&lt;/P&gt;
&lt;P&gt;I've just tried out your new formula and unfortunately it is not working. Maybe I should show you my output and give you some more information.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is how my data looks at the beginning:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vkal12_1-1663922304608.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89748iB40A499930BC24B0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vkal12_1-1663922304608.png" alt="vkal12_1-1663922304608.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example b) my graph should look like this in the end with using the following formula:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=COUNT({&amp;lt; [Intervall] = {"=weekday([Intervall])&amp;gt;=0"} * {"=weekday(Intervall])&amp;lt;=5"}&amp;gt;} transportid)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vkal12_3-1663922485878.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89750iF6F6EEC6B8FFD2F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vkal12_3-1663922485878.png" alt="vkal12_3-1663922485878.png" /&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;This seems to work and looks good. The problem now is that it is summing up all the transport ids for the specific day. For today (Fr) we had nine incoming files each with 23067 transport ids, resulting in 207603 transport ids in total. I already have a Date Field included in my data model, just with a little bit different formula:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vkal12_4-1663922768246.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89751i5710326C288119CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vkal12_4-1663922768246.png" alt="vkal12_4-1663922768246.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I use your suggested formuala then it will look like this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=COUNT({&amp;lt;[Intervall] = {"=weekday(Intervall)&amp;gt;=0"} * {"=weekday(Intervall)&amp;lt;=5"} * {"=Intervall=aggr(max(total Key_Datum Intervall]), Key_Datum)"}&amp;gt;} transportid)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vkal12_5-1663922927875.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89752iD89AAA2BEACA1AC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vkal12_5-1663922927875.png" alt="vkal12_5-1663922927875.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately I do not get any kind of values back. Therefore my graph is of course not showing anything relevant as well. Do you have any other idea?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 08:49:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-based-on-the-latest-file-without-deleting-duplicates/m-p/1984593#M81244</guid>
      <dc:creator>vkal12</dc:creator>
      <dc:date>2022-09-23T08:49:28Z</dc:date>
    </item>
  </channel>
</rss>

