<?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 Date Aggregation for Year N-1 in Qlik Application in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Date-Aggregation-for-Year-N-1-in-Qlik-Application/m-p/2470642#M99640</link>
    <description>&lt;P&gt;Hello Qlik Community,&lt;/P&gt;
&lt;P&gt;I have a Qlik application with multiple filters (Year, Month, Date, InternalRef) and two dropdowns that update my variables v_heureDebut &amp;amp; v_heureFin. My dataset contains the number of clients at half-hour intervals, and I need to calculate the average per date. I created the following measure:&lt;/P&gt;
&lt;P&gt;AVG(&lt;BR /&gt;Aggr(&lt;BR /&gt;sum({&amp;lt;heureDebut = {"=heureDebut &amp;gt;= '$(v_heureDebut)'"}, heureFin = {"=heureFin &amp;lt;= '$(v_heureFin)'"}&amp;gt;} clients),&lt;BR /&gt;date, Boulangerie&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works perfectly for the current year (Year N). However, I encounter aggregation issues when I try to perform a similar calculation for the previous year (Year N-1). I have two scenarios to handle:&lt;/P&gt;
&lt;P&gt;Only one date is selected.&lt;BR /&gt;Multiple dates are selected.&lt;BR /&gt;Here's the expression I am using:&lt;/P&gt;
&lt;P&gt;Only one date is selected.&lt;BR /&gt;Multiple dates are selected.&lt;BR /&gt;Here's the expression I am using:&lt;BR /&gt;&lt;BR /&gt;If(GetSelectedCount(date) = 1,&lt;BR /&gt;AVG(&lt;BR /&gt;Aggr(&lt;BR /&gt;sum(&lt;BR /&gt;{&amp;lt;&lt;BR /&gt;heureDebut = {"=heureDebut &amp;gt;= '$(v_heureDebut)'"},&lt;BR /&gt;heureFin = {"=heureFin &amp;lt;= '$(v_heureFin)'"},&lt;BR /&gt;typeTicket = {0, 200, 201},&lt;BR /&gt;annee=,&lt;BR /&gt;mois=,&lt;BR /&gt;jour=,&lt;BR /&gt;date = {"$(=Date(min(date) - 364, 'DD/MM/YYYY'))"}&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;clients&lt;BR /&gt;),&lt;BR /&gt;refInterne&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;AVG(&lt;BR /&gt;Aggr(&lt;BR /&gt;sum(&lt;BR /&gt;{&amp;lt;&lt;BR /&gt;heureDebut = {"=heureDebut &amp;gt;= '$(v_heureDebut)'"},&lt;BR /&gt;heureFin = {"=heureFin &amp;lt;= '$(v_heureFin)'"},&lt;BR /&gt;typeTicket = {0, 200, 201},&lt;BR /&gt;annee=,&lt;BR /&gt;mois=,&lt;BR /&gt;jour=,&lt;BR /&gt;date = {"&amp;gt;=$(=Date(AddYears(min(date), -1), 'DD/MM/YYYY')) &amp;lt;=$(=Date(AddYears(max(date), -1), 'DD/MM/YYYY'))"}&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;clients&lt;BR /&gt;),&lt;BR /&gt;refInterne, date&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The first scenario works well since there is no need for date aggregation with a single selected date. However, in the second scenario, when aggregating by date and refInterne, it fails.&lt;/P&gt;
&lt;P&gt;I am not sure why this happens and would appreciate any insights or solutions you might have.&lt;/P&gt;
&lt;P&gt;Thank you in advance for your help!&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jul 2024 09:53:11 GMT</pubDate>
    <dc:creator>mehdi_asma</dc:creator>
    <dc:date>2024-07-15T09:53:11Z</dc:date>
    <item>
      <title>Date Aggregation for Year N-1 in Qlik Application</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Aggregation-for-Year-N-1-in-Qlik-Application/m-p/2470642#M99640</link>
      <description>&lt;P&gt;Hello Qlik Community,&lt;/P&gt;
&lt;P&gt;I have a Qlik application with multiple filters (Year, Month, Date, InternalRef) and two dropdowns that update my variables v_heureDebut &amp;amp; v_heureFin. My dataset contains the number of clients at half-hour intervals, and I need to calculate the average per date. I created the following measure:&lt;/P&gt;
&lt;P&gt;AVG(&lt;BR /&gt;Aggr(&lt;BR /&gt;sum({&amp;lt;heureDebut = {"=heureDebut &amp;gt;= '$(v_heureDebut)'"}, heureFin = {"=heureFin &amp;lt;= '$(v_heureFin)'"}&amp;gt;} clients),&lt;BR /&gt;date, Boulangerie&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works perfectly for the current year (Year N). However, I encounter aggregation issues when I try to perform a similar calculation for the previous year (Year N-1). I have two scenarios to handle:&lt;/P&gt;
&lt;P&gt;Only one date is selected.&lt;BR /&gt;Multiple dates are selected.&lt;BR /&gt;Here's the expression I am using:&lt;/P&gt;
&lt;P&gt;Only one date is selected.&lt;BR /&gt;Multiple dates are selected.&lt;BR /&gt;Here's the expression I am using:&lt;BR /&gt;&lt;BR /&gt;If(GetSelectedCount(date) = 1,&lt;BR /&gt;AVG(&lt;BR /&gt;Aggr(&lt;BR /&gt;sum(&lt;BR /&gt;{&amp;lt;&lt;BR /&gt;heureDebut = {"=heureDebut &amp;gt;= '$(v_heureDebut)'"},&lt;BR /&gt;heureFin = {"=heureFin &amp;lt;= '$(v_heureFin)'"},&lt;BR /&gt;typeTicket = {0, 200, 201},&lt;BR /&gt;annee=,&lt;BR /&gt;mois=,&lt;BR /&gt;jour=,&lt;BR /&gt;date = {"$(=Date(min(date) - 364, 'DD/MM/YYYY'))"}&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;clients&lt;BR /&gt;),&lt;BR /&gt;refInterne&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;AVG(&lt;BR /&gt;Aggr(&lt;BR /&gt;sum(&lt;BR /&gt;{&amp;lt;&lt;BR /&gt;heureDebut = {"=heureDebut &amp;gt;= '$(v_heureDebut)'"},&lt;BR /&gt;heureFin = {"=heureFin &amp;lt;= '$(v_heureFin)'"},&lt;BR /&gt;typeTicket = {0, 200, 201},&lt;BR /&gt;annee=,&lt;BR /&gt;mois=,&lt;BR /&gt;jour=,&lt;BR /&gt;date = {"&amp;gt;=$(=Date(AddYears(min(date), -1), 'DD/MM/YYYY')) &amp;lt;=$(=Date(AddYears(max(date), -1), 'DD/MM/YYYY'))"}&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;clients&lt;BR /&gt;),&lt;BR /&gt;refInterne, date&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The first scenario works well since there is no need for date aggregation with a single selected date. However, in the second scenario, when aggregating by date and refInterne, it fails.&lt;/P&gt;
&lt;P&gt;I am not sure why this happens and would appreciate any insights or solutions you might have.&lt;/P&gt;
&lt;P&gt;Thank you in advance for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 09:53:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Aggregation-for-Year-N-1-in-Qlik-Application/m-p/2470642#M99640</guid>
      <dc:creator>mehdi_asma</dc:creator>
      <dc:date>2024-07-15T09:53:11Z</dc:date>
    </item>
  </channel>
</rss>

