<?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: Avg time between events - avg aggr above problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571442#M456833</link>
    <description>Hi, using structured parameter to sort date dimension in aggr seems to work:&lt;BR /&gt;=avg(aggr(date_passage-above(date_passage),idrcu_visite,(date_passage,(NUMERIC, ASCENDING))))&lt;BR /&gt;&lt;BR /&gt;For purchases:&lt;BR /&gt;=num(avg(aggr(date_achat -above(date_achat),idrcu_achat,(date_achat,(NUMERIC, ASCENDING))))*24*60,'#&amp;nbsp;##0')&amp;amp;' minutes'</description>
    <pubDate>Fri, 19 Apr 2019 17:53:47 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2019-04-19T17:53:47Z</dc:date>
    <item>
      <title>Avg time between events - avg aggr above problem</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571345#M456830</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple table where I have different users with dates corresponding to 2 types of events&lt;/P&gt;&lt;P&gt;pruchasing or visit. I've also created a field called date_common which concatenates both events for a user.&lt;/P&gt;&lt;P&gt;So I have a table like (see file enclosed)&lt;/P&gt;&lt;P&gt;User&amp;nbsp; Date_common Date_purchase Date_visit flag_purchase flag_visit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I load the data I make sure to have an "order by User,Date_common" so that I am sure that the data is sorted in chronological order for any user (very important for above function)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I am trying to calculate for these 2 types of event (purchase and visit)&lt;/P&gt;&lt;P&gt;the average time between 2 events (so average time between 2 purchases and average time between 2 visits)&lt;/P&gt;&lt;P&gt;If you look at my data we should have&lt;/P&gt;&lt;P&gt;avg time between 2 purchases : 43min&lt;/P&gt;&lt;P&gt;avg time between 2 visits : 53min&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can find these results when creating a straight table.&lt;/P&gt;&lt;P&gt;but when I want to aggregate to have this expression in a single text box I have a totally different result&lt;/P&gt;&lt;P&gt;The expression in my text box is (avg time between 2 purchases in minutes)&lt;/P&gt;&lt;P&gt;=avg(aggr(date_purchase -above(date_purchase ),user,date_purchase ))*24*60)&lt;/P&gt;&lt;P&gt;which gives me something like '-2' and I don't understand where it comes from&lt;/P&gt;&lt;P&gt;(same goes for date_visit with this expression using date_visit I find -16minutes)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to sort the data using the script in different ways but no matter the sort I still find these same values that are wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me ?&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:48:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571345#M456830</guid>
      <dc:creator>Hakisback</dc:creator>
      <dc:date>2024-11-16T03:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Avg time between events - avg aggr above problem</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571365#M456831</link>
      <description>&lt;P&gt;Hi, I'm not seeing the same issue, data in text box also says 43 min, PFA.&lt;/P&gt;&lt;P&gt;I tried some selections but I can't reproduce the '-2'.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2019 11:54:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571365#M456831</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2019-04-19T11:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Avg time between events - avg aggr above problem</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571417#M456832</link>
      <description>&lt;P&gt;Thanks for the reply but it doesn't work for me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Enclosed all my data you will see that the calculation is not working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2019 14:40:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571417#M456832</guid>
      <dc:creator>Hakisback</dc:creator>
      <dc:date>2019-04-19T14:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: Avg time between events - avg aggr above problem</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571442#M456833</link>
      <description>Hi, using structured parameter to sort date dimension in aggr seems to work:&lt;BR /&gt;=avg(aggr(date_passage-above(date_passage),idrcu_visite,(date_passage,(NUMERIC, ASCENDING))))&lt;BR /&gt;&lt;BR /&gt;For purchases:&lt;BR /&gt;=num(avg(aggr(date_achat -above(date_achat),idrcu_achat,(date_achat,(NUMERIC, ASCENDING))))*24*60,'#&amp;nbsp;##0')&amp;amp;' minutes'</description>
      <pubDate>Fri, 19 Apr 2019 17:53:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571442#M456833</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2019-04-19T17:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Avg time between events - avg aggr above problem</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571902#M456834</link>
      <description>&lt;P&gt;This is it !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 07:42:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-time-between-events-avg-aggr-above-problem/m-p/1571902#M456834</guid>
      <dc:creator>Hakisback</dc:creator>
      <dc:date>2019-04-23T07:42:06Z</dc:date>
    </item>
  </channel>
</rss>

