<?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: Comparing Quarters different years in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2515197#M105652</link>
    <description>&lt;P&gt;Thanks for the suggestion, in this case the End user would select 2025-Q1 and 2024-Q4 for example which only works when using the YearQuarter field as it is two different years, so selecting Year 2024 and Year 2025 + Quarter Q1 + Quarter Q4 would result in 2025-Q1, 2024-Q1, 2025-Q1, 2025-Q4 instead of desired sum of Sales 2025-Q1 + 2024-Q4 which would then be compared to the sum of Sales 2024-Q1 + 2023-Q4.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried out your suggestion but can not get the&amp;nbsp;&lt;SPAN&gt;Date = {"= (Date&amp;gt;=AddYears(min(Date), -1)) * (Date&amp;lt;=AddYears(max(Date),-1)) "} to return me a result altho the Dates seems to be working:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sosl11_0-1745335920558.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/179793i76AAFE26A8AB7A2A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sosl11_0-1745335920558.png" alt="sosl11_0-1745335920558.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Apr 2025 15:36:11 GMT</pubDate>
    <dc:creator>sosl11</dc:creator>
    <dc:date>2025-04-22T15:36:11Z</dc:date>
    <item>
      <title>Comparing Quarters different years</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2514805#M105573</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the best way to achieve the following:&lt;/P&gt;&lt;P&gt;User selects 2025-Q1, 2024-Q4, 2024-Q3, 2024-Q2&lt;/P&gt;&lt;P&gt;User wants to see the Sum(Sales)&lt;/P&gt;&lt;P&gt;But now User wants to compare it to&amp;nbsp; 2024-Q1, 2023-Q4, 2023-Q3, 2023-Q2&lt;/P&gt;&lt;P&gt;This should also work when 2 or 3 Quarters are selected&lt;/P&gt;&lt;P&gt;2025-Q1, 2024-Q4, 2024-Q3 vs. 2024-Q1, 2023-Q4, 2023-Q3&lt;/P&gt;&lt;P&gt;2025-Q1, 2024-Q4 vs. 2024-Q1, 2023-Q4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SalesData:
LOAD
    Date(Date#(Date, 'DD/MM/YYYY')) as Date,
    Sales,
    Customer,
    Year(Date#(Date, 'DD/MM/YYYY')) as Year,
    Month(Date#(Date, 'DD/MM/YYYY')) as Month,
    'Q' &amp;amp; Ceil(Month(Date#(Date, 'DD/MM/YYYY')) / 3) as Quarter,
    Year(Date#(Date, 'DD/MM/YYYY')) &amp;amp; '-Q' &amp;amp; Ceil(Month(Date#(Date, 'DD/MM/YYYY')) / 3) as YearQuarter,
    Year(Date#(Date, 'DD/MM/YYYY')) - 1 &amp;amp; '-Q' &amp;amp; Ceil(Month(Date#(Date, 'DD/MM/YYYY')) / 3) as YearQuarterCompare
INLINE [
    Date, Sales, Customer
    01/01/2025, 22, 1
    02/01/2025, 33, 1
    01/02/2025, 44, 1
    02/02/2025, 55, 1
    01/03/2025, 66, 1
    02/03/2025, 77, 1
    01/04/2025, 88, 1
    02/04/2025, 99, 1
    01/01/2024, 91, 1
    02/01/2024, 92, 1
    01/02/2024, 81, 1
    02/02/2024, 82, 1
    01/03/2024, 71, 1
    02/03/2024, 72, 1
    01/04/2024, 63, 1
    02/04/2024, 64, 1
    01/05/2024, 54, 1
    02/05/2024, 53, 1
    01/06/2024, 43, 1
    02/06/2024, 42, 1
    01/07/2024, 31, 1
    02/07/2024, 32, 1
    01/08/2024, 21, 1
    02/08/2024, 23, 1
    01/09/2024, 12, 1
    01/09/2024, 13, 1
    01/10/2024, 101, 1
    02/10/2024, 103, 1
    01/11/2024, 113, 1
    02/11/2024, 114, 1
    01/12/2024, 125, 1
    02/12/2024, 126, 1
    01/01/2023, 133, 1
    02/01/2023, 134, 1
    01/02/2023, 143, 1
    02/02/2023, 144, 1
    01/03/2023, 154, 1
    02/03/2023, 155, 1
    01/04/2023, 166, 1
    02/04/2023, 167, 1
    01/05/2023, 178, 1
    02/05/2023, 179, 1
    01/06/2023, 181, 1
    02/06/2023, 182, 1
    01/07/2023, 191, 1
    02/07/2023, 192, 1
    01/08/2023, 67, 1
    02/08/2023, 69, 1
    01/09/2023, 79, 1
    01/09/2023, 78, 1
    01/10/2023, 89, 1
    02/10/2023, 83, 1
    01/11/2023, 73, 1
    02/11/2023, 74, 1
    01/12/2023, 65, 1
    02/12/2023, 64, 1
];&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 18 Apr 2025 09:15:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2514805#M105573</guid>
      <dc:creator>sosl11</dc:creator>
      <dc:date>2025-04-18T09:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Quarters different years</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2514851#M105584</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I'll give you a line of thought that should bring you to the solution. Disregard the number of selected Quarters. Your users select a range of dates - hopefully the set of Quarters that they select is consecutive with no "holes" in between.&lt;/P&gt;&lt;P&gt;So, the "current period sales" calculation should include Set Analysis that selects the Date between the min available date and the max available date. Something along these lines:&lt;/P&gt;&lt;P&gt;Date = {"= (Date&amp;gt;=min(Date)) * (Date&amp;lt;=max(Date)) "}&lt;/P&gt;&lt;P&gt;Notice that I opted to use the Advanced (expression) Search rather than simple search, to be free from the date formatting issues.&lt;/P&gt;&lt;P&gt;Now, the "comparative period sales" calculation should be similar, but use the min date - 1 year and the max date - 1 year in the condition:&lt;BR /&gt;&lt;BR /&gt;Date = {"= (Date&amp;gt;=AddYears(min(Date), -1)) * (Date&amp;lt;=AddYears(max(Date),-1)) "}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Come to my Set Analysis session at the &lt;A href="https://masterssummit.com" target="_blank" rel="noopener"&gt;Masters Summit for Qlik&lt;/A&gt; to learn more about advanced uses of Set Analysis.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 16:19:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2514851#M105584</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2025-04-18T16:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Quarters different years</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2515099#M105622</link>
      <description>&lt;P&gt;You need only an appropriate running period-field which might be created with interrecord-functions or autonumber() or with a simple calculation like:&lt;/P&gt;&lt;P&gt;Year * 4 + Quarter as RunningQuarter&lt;/P&gt;&lt;P&gt;and then querying:&lt;/P&gt;&lt;P&gt;{"&amp;gt;=$(=max(RunningQuarter)-4)&amp;lt;=$(=max(RunningQuarter)-4)"}&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 11:04:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2515099#M105622</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-04-22T11:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Quarters different years</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2515197#M105652</link>
      <description>&lt;P&gt;Thanks for the suggestion, in this case the End user would select 2025-Q1 and 2024-Q4 for example which only works when using the YearQuarter field as it is two different years, so selecting Year 2024 and Year 2025 + Quarter Q1 + Quarter Q4 would result in 2025-Q1, 2024-Q1, 2025-Q1, 2025-Q4 instead of desired sum of Sales 2025-Q1 + 2024-Q4 which would then be compared to the sum of Sales 2024-Q1 + 2023-Q4.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried out your suggestion but can not get the&amp;nbsp;&lt;SPAN&gt;Date = {"= (Date&amp;gt;=AddYears(min(Date), -1)) * (Date&amp;lt;=AddYears(max(Date),-1)) "} to return me a result altho the Dates seems to be working:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sosl11_0-1745335920558.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/179793i76AAFE26A8AB7A2A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sosl11_0-1745335920558.png" alt="sosl11_0-1745335920558.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 15:36:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2515197#M105652</guid>
      <dc:creator>sosl11</dc:creator>
      <dc:date>2025-04-22T15:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Quarters different years</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2515201#M105653</link>
      <description>&lt;P&gt;Ah thanks that is also an idea, this would not working with my current Quarter field but would work with QuarterNr:&lt;/P&gt;&lt;P&gt;Ceil(Month(Date#(Date, 'DD/MM/YYYY')) / 3) as QuarterNr&lt;/P&gt;&lt;P&gt;I do unfortunately not get a result from the set expression:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sosl11_1-1745336218030.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/179794i974803A6695A4F6E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sosl11_1-1745336218030.png" alt="sosl11_1-1745336218030.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 15:40:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2515201#M105653</guid>
      <dc:creator>sosl11</dc:creator>
      <dc:date>2025-04-22T15:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Quarters different years</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2515625#M105685</link>
      <description>&lt;P&gt;Ah that would work with:&lt;/P&gt;&lt;P&gt;Sum({&lt;BR /&gt;&amp;lt;YearQuarterNr=,&lt;BR /&gt;RunningQuarter = {"&amp;gt;=$(=min(RunningQuarter)-4)&amp;lt;=$(=max(RunningQuarter)-4)"&lt;BR /&gt;}&amp;gt;&lt;BR /&gt;} Sales)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lets see if that is sufficient.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;!--  
        Layout, Style or Voice Helpers
      --&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;!--  
        Compliance
      --&gt;&lt;DIV class=""&gt;&lt;!--   For autoSmartRem addNewWindowWarnings div is referenced in an aria-describedby   --&gt;&lt;DIV&gt;Opens in new window&lt;/DIV&gt;&lt;DIV&gt;PDF Download&lt;/DIV&gt;&lt;DIV&gt;Word Download&lt;/DIV&gt;&lt;DIV&gt;Excel Download&lt;/DIV&gt;&lt;DIV&gt;PowerPoint Download&lt;/DIV&gt;&lt;DIV&gt;Document Download&lt;/DIV&gt;&lt;/DIV&gt;&lt;!--  
        Versioning Control Panel if versioning = true !
      --&gt;&lt;!--  
        Launcher
      --&gt;&lt;!--   Toolbar   --&gt;&lt;!--  
        Site Menu
      --&gt;&lt;!--  
        Generic Aria Live message container
      --&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;!--   Symbol definitions   --&gt;&lt;/DIV&gt;&lt;!--   end #ae_app   --&gt;</description>
      <pubDate>Thu, 24 Apr 2025 10:19:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2515625#M105685</guid>
      <dc:creator>sosl11</dc:creator>
      <dc:date>2025-04-24T10:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Quarters different years</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2516243#M105772</link>
      <description>&lt;P&gt;Hi Oleg,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please elaborate a bit more on the Advanced Search? How can one output what comes out the Advanced Search (so the result)? Does that work in a text box somehow?&lt;/P&gt;&lt;P&gt;This works for Current Period Sales:&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;YearQuarterNr=, Date={"=(Date&amp;gt;=min(Date)) * (Date&amp;lt;=max(Date))"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;This does not return me the C&lt;SPAN&gt;omparative&amp;nbsp;P&lt;/SPAN&gt;eriod Sales:&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;YearQuarterNr=, Date = {"=(Date&amp;gt;=AddYears(min(Date), -1)) * (Date&amp;lt;=AddYears(max(Date),-1))"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would think it maybe has something to do within the Advanced Search string, but how do I check that? Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 07:23:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2516243#M105772</guid>
      <dc:creator>sosl11</dc:creator>
      <dc:date>2025-04-30T07:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Quarters different years</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2516331#M105780</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Advanced Search is simply an expression. It returns a number. Any number other than zero is considered as TRUE, and zero result is considered FALSE.&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the surface, I can't see any issues with your expressions,&amp;nbsp; but I'd need to dive into the data and into the syntax to find out what's not working as expected...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 15:37:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2516331#M105780</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2025-04-30T15:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Quarters different years</title>
      <link>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2517009#M105860</link>
      <description>&lt;P&gt;I got it to work with this now:&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;YearQuarterNr=,Date = {"&amp;gt;=$(=Date(AddYears(Min(Date), -1)))&amp;lt;=$(=Date(AddYears(Max(Date), -1)))"}&amp;gt;} Sales)&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 14:02:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Comparing-Quarters-different-years/m-p/2517009#M105860</guid>
      <dc:creator>sosl11</dc:creator>
      <dc:date>2025-05-07T14:02:17Z</dc:date>
    </item>
  </channel>
</rss>

