<?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 sum depending on the date difference in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Calculation-sum-depending-on-the-date-difference/m-p/1835592#M69036</link>
    <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently working on an application that will show me the total open items of our customers.&lt;/P&gt;&lt;P&gt;For this purpose, there are various time intervals of overdue, e.g. less than 0 days, 1 to 30 days, etc.&amp;nbsp;I calculate this with the due date and a reference date:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= if(
Interval([reference_date]-[due_date],'d') &amp;lt;= 0, Sum([Amount])
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;= if(
Interval([reference_date]-[due_date],'d') &amp;lt;= 0 and Interval([reference_date]-[due_date],'d') &amp;lt;= 30, Sum([Amount])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works as long as I have the due date as a dimension in my table.&lt;/P&gt;&lt;P&gt;As soon as I remove the due date from the table, nothing is calculated anymore.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I make the calculation work in aggregated form?&lt;/P&gt;</description>
    <pubDate>Mon, 13 Sep 2021 12:56:08 GMT</pubDate>
    <dc:creator>v_n</dc:creator>
    <dc:date>2021-09-13T12:56:08Z</dc:date>
    <item>
      <title>Calculation sum depending on the date difference</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-sum-depending-on-the-date-difference/m-p/1835592#M69036</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently working on an application that will show me the total open items of our customers.&lt;/P&gt;&lt;P&gt;For this purpose, there are various time intervals of overdue, e.g. less than 0 days, 1 to 30 days, etc.&amp;nbsp;I calculate this with the due date and a reference date:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= if(
Interval([reference_date]-[due_date],'d') &amp;lt;= 0, Sum([Amount])
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;= if(
Interval([reference_date]-[due_date],'d') &amp;lt;= 0 and Interval([reference_date]-[due_date],'d') &amp;lt;= 30, Sum([Amount])
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works as long as I have the due date as a dimension in my table.&lt;/P&gt;&lt;P&gt;As soon as I remove the due date from the table, nothing is calculated anymore.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I make the calculation work in aggregated form?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 12:56:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-sum-depending-on-the-date-difference/m-p/1835592#M69036</guid>
      <dc:creator>v_n</dc:creator>
      <dc:date>2021-09-13T12:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation sum depending on the date difference</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-sum-depending-on-the-date-difference/m-p/1835598#M69037</link>
      <description>&lt;P&gt;Try this may be&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=Sum(If(Interval([reference_date]-[due_date], 'd') &amp;lt;= 0, [Amount]))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;= Sum(If(Interval([reference_date]-[due_date], 'd') &amp;gt; 0 and Interval([reference_date]-[due_date], 'd') &amp;lt;= 30, [Amount]))&lt;/LI-CODE&gt;&lt;P&gt;But a more efficient way to do this would be to create a new field in the script&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Interval([reference_date]-[due_date], 'd') as duration&lt;/LI-CODE&gt;&lt;P&gt;and then use that in your set analysis&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=Sum({&amp;lt;duration = {"&amp;lt;=0"}&amp;gt;}[Amount])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;=Sum({&amp;lt;duration = {"&amp;gt;0&amp;lt;=30"}&amp;gt;}[Amount])&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 13 Sep 2021 13:08:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-sum-depending-on-the-date-difference/m-p/1835598#M69037</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2021-09-13T13:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation sum depending on the date difference</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-sum-depending-on-the-date-difference/m-p/1835611#M69038</link>
      <description>&lt;P&gt;Thank you! It works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The more efficient way does not work for me because I want to select the reference date in a filter within my app.&lt;/P&gt;&lt;P&gt;But the other solution is fine.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 13:29:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-sum-depending-on-the-date-difference/m-p/1835611#M69038</guid>
      <dc:creator>v_n</dc:creator>
      <dc:date>2021-09-13T13:29:03Z</dc:date>
    </item>
  </channel>
</rss>

