<?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 Re: Calculate Measure based on variable dates in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2427716#M96285</link>
    <description>&lt;P&gt;Below is a sample of the relevant data. There are multiple additional dimensions.&lt;/P&gt;
&lt;TABLE width="475"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="71"&gt;event_date&lt;/TD&gt;
&lt;TD width="97"&gt;subscription_id&lt;/TD&gt;
&lt;TD width="95"&gt;payment_cycle&lt;/TD&gt;
&lt;TD width="84"&gt;billing_period&lt;/TD&gt;
&lt;TD width="64"&gt;metric&lt;/TD&gt;
&lt;TD width="64"&gt;value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1/2/2022&lt;/TD&gt;
&lt;TD&gt;274627645&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;yearly&lt;/TD&gt;
&lt;TD&gt;direct_purchase&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1/2/2023&lt;/TD&gt;
&lt;TD&gt;274627645&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;yearly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1/2/2024&lt;/TD&gt;
&lt;TD&gt;274627645&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;yearly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5/7/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;started_trial&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/7/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;after_trial_purchase&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/8/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/9/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/10/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Wed, 06 Mar 2024 11:42:58 GMT</pubDate>
    <dc:creator>S-D</dc:creator>
    <dc:date>2024-03-06T11:42:58Z</dc:date>
    <item>
      <title>Calculate Measure based on variable dates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2424801#M96019</link>
      <description>&lt;P&gt;In the table below the number of purchases is calculated based on a hardcoded date.&lt;/P&gt;
&lt;P&gt;What i need to accomplish is to calculate it based on the Start and End date for each combination of Billing period and Payment cycle. So the calculation of each value of Purchases will be based on different dates.&lt;/P&gt;
&lt;P&gt;Using the formulas for Start and End dates in the set analysis does not work.&lt;/P&gt;
&lt;P&gt;Pre-aggregated table is not an option due to the infinite combinations of payment cycles and billing periods and the volume of data.&lt;/P&gt;
&lt;P&gt;Any suggestions on how to accomplish that?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SD_0-1709133349859.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/160871i55E44C0E8237D77F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SD_0-1709133349859.png" alt="SD_0-1709133349859.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 21:02:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2424801#M96019</guid>
      <dc:creator>S-D</dc:creator>
      <dc:date>2024-11-15T21:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Measure based on variable dates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2425381#M96096</link>
      <description>&lt;P&gt;How does the underlying table look in the data model?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 14:52:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2425381#M96096</guid>
      <dc:creator>henrikalmen</dc:creator>
      <dc:date>2024-02-29T14:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Measure based on variable dates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2427716#M96285</link>
      <description>&lt;P&gt;Below is a sample of the relevant data. There are multiple additional dimensions.&lt;/P&gt;
&lt;TABLE width="475"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="71"&gt;event_date&lt;/TD&gt;
&lt;TD width="97"&gt;subscription_id&lt;/TD&gt;
&lt;TD width="95"&gt;payment_cycle&lt;/TD&gt;
&lt;TD width="84"&gt;billing_period&lt;/TD&gt;
&lt;TD width="64"&gt;metric&lt;/TD&gt;
&lt;TD width="64"&gt;value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1/2/2022&lt;/TD&gt;
&lt;TD&gt;274627645&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;yearly&lt;/TD&gt;
&lt;TD&gt;direct_purchase&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1/2/2023&lt;/TD&gt;
&lt;TD&gt;274627645&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;yearly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1/2/2024&lt;/TD&gt;
&lt;TD&gt;274627645&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;yearly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5/7/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;started_trial&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/7/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;after_trial_purchase&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/8/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/9/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/10/2023&lt;/TD&gt;
&lt;TD&gt;982473564&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;monthly&lt;/TD&gt;
&lt;TD&gt;renewal&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Wed, 06 Mar 2024 11:42:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2427716#M96285</guid>
      <dc:creator>S-D</dc:creator>
      <dc:date>2024-03-06T11:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Measure based on variable dates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2427838#M96302</link>
      <description>&lt;P&gt;so what is the expected output from this data?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 14:48:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2427838#M96302</guid>
      <dc:creator>ali_hijazi</dc:creator>
      <dc:date>2024-03-06T14:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Measure based on variable dates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2430367#M96525</link>
      <description>&lt;P&gt;The renewals were made during the period selected in the calendar and split by billing period and payment cycle. I am trying to calculate from how many new purchases they were made.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;Calendar period: 10.01.2024 - 20.01.2024&lt;/P&gt;
&lt;P&gt;If we have 5 yearly renewals with payment cycle 3 in this period, I need to find out how many new yearly purchases were made 2 (payment cycle -1) yearly periods back (&lt;STRONG&gt;10.01.2022-20.01.2022)&lt;/STRONG&gt;.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;In the same column, for monthly new purchases i will have to calculate the new purchases for 2 monthly periods back &lt;STRONG&gt;(10.11.2023-20.11.2023)&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;I have managed to get the correct periods for each value (Start and End date) but cannot find a way to use them in the set analysis. I have tried saving their formulas in variables but since their values are different for each cell of the table, the formula doesn't work.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 13:52:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2430367#M96525</guid>
      <dc:creator>S-D</dc:creator>
      <dc:date>2024-03-13T13:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Measure based on variable dates</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2430686#M96553</link>
      <description>&lt;P&gt;A pre-aggregating in the data-model may not the most suitable way but it doesn't mean that you couldn't pre-calculate some essential results, for example by creating one or several flag-fields.&lt;/P&gt;
&lt;P&gt;This might be done with interrecord-functions within sorted resident-loads like:&lt;/P&gt;
&lt;P&gt;load *, if(previous(id) = id, 0, 1) as FirstFlag&lt;BR /&gt;resident X order by id, date;&lt;/P&gt;
&lt;P&gt;and descending executed the LastFlag could be created and instead of 0/1 also an accumulation might be applied. Alternatives may a self-joining aggregation-load with min/max/count and an afterwards-check.&lt;/P&gt;
&lt;P&gt;Also thinkable are approaches with exists() and/or offset-calculations of the dates to today() and various similar measures.&lt;/P&gt;
&lt;P&gt;The aim behind the above hints is to unify the different dates and numbers of occurrences per id to global valide values. In the simplest way it's a 0/1 flag which is always the same for each id and could be therefore queried in a set analysis.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 09:30:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-Measure-based-on-variable-dates/m-p/2430686#M96553</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2024-03-14T09:30:06Z</dc:date>
    </item>
  </channel>
</rss>

