<?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: Set Analysis Max completed Month current vs. previous year in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537307#M108786</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/158672"&gt;@Corfiz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you, please, try this set analysis?&lt;/P&gt;
&lt;P&gt;=only({&amp;lt;MaxMonthFlag={1}&amp;gt;} Month) &amp;amp;'-'&amp;amp; num(SelectedYear-1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I obtain the table below with it. However, I'm not sure if your data is more complex. In that case, if you could provide more details about it, I will try to help you:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daniel_Castella_0-1764158503442.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/185265i9F8EC64EDB25B033/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daniel_Castella_0-1764158503442.png" alt="Daniel_Castella_0-1764158503442.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Wed, 26 Nov 2025 12:02:48 GMT</pubDate>
    <dc:creator>Daniel_Castella</dc:creator>
    <dc:date>2025-11-26T12:02:48Z</dc:date>
    <item>
      <title>Set Analysis Max completed Month current vs. previous year</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537301#M108784</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I feel like a moron, but I can't figure it out myself.&lt;/P&gt;&lt;P&gt;I have a report that requires year selection. The final column is the last month of the selected year versus the same month in the previous year. For completed years, that would be "December selected year" vs. "December prev. year" - no problem.&lt;/P&gt;&lt;P&gt;But for the current year, we need the last completed month (NOT the current month!) vs. the same month in the previous year. I've set a flag for "MaxMonth" of each period, so that I can "set-analysis" that month for every year selected - but how do I get that same month in the previous year?&lt;/P&gt;&lt;P&gt;If I just set set analysis on the MaxMonth-Flag and take year-1, it will give me December, because that's the month with the MaxMonth-Flag in the previous year.&lt;/P&gt;&lt;P&gt;I've tried all kinds of things with "addyears()" in a set analysis function etc., but none of it worked. Help, please!&amp;nbsp;&lt;/P&gt;&lt;P&gt;MaxMonthFlag&amp;nbsp; &amp;nbsp; &amp;nbsp; SelectedYear&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Month&amp;nbsp; &amp;nbsp; &amp;nbsp; vs.MonthPrevYear&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2025 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10-2024&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2024 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12-2023&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2023 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12-2022&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Nov 2025 11:38:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537301#M108784</guid>
      <dc:creator>Corfiz</dc:creator>
      <dc:date>2025-11-26T11:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Max completed Month current vs. previous year</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537307#M108786</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/158672"&gt;@Corfiz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you, please, try this set analysis?&lt;/P&gt;
&lt;P&gt;=only({&amp;lt;MaxMonthFlag={1}&amp;gt;} Month) &amp;amp;'-'&amp;amp; num(SelectedYear-1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I obtain the table below with it. However, I'm not sure if your data is more complex. In that case, if you could provide more details about it, I will try to help you:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daniel_Castella_0-1764158503442.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/185265i9F8EC64EDB25B033/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daniel_Castella_0-1764158503442.png" alt="Daniel_Castella_0-1764158503442.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 26 Nov 2025 12:02:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537307#M108786</guid>
      <dc:creator>Daniel_Castella</dc:creator>
      <dc:date>2025-11-26T12:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Max completed Month current vs. previous year</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537308#M108787</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;thanks for your reply!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need that expression to work in a set analysis-expression - something like&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&amp;lt; MonthNum = {"= addyears({&amp;lt;&amp;nbsp;&lt;SPAN&gt;MaxMonthFlag={1}&amp;nbsp;&lt;/SPAN&gt;&amp;gt;} MonthYear, -1)"} &amp;gt;}&lt;/P&gt;&lt;P&gt;Sales )&lt;/P&gt;&lt;P&gt;or something to that effect.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Nov 2025 12:16:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537308#M108787</guid>
      <dc:creator>Corfiz</dc:creator>
      <dc:date>2025-11-26T12:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Max completed Month current vs. previous year</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537316#M108789</link>
      <description>&lt;P&gt;May be this&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;Year = { '$(=GetFieldSelections(Year) - 1)' },Month = {'$(=Only({&amp;lt;MaxMonthFlag={'1'}&amp;gt;} Month))'}&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;Year = { '$(=Max(Year) - 1)' },Month = P(Month)&amp;gt;}Sales)&lt;/P&gt;</description>
      <pubDate>Wed, 26 Nov 2025 13:57:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537316#M108789</guid>
      <dc:creator>Nagaraju_KCS</dc:creator>
      <dc:date>2025-11-26T13:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Max completed Month current vs. previous year</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537320#M108791</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/158672"&gt;@Corfiz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I think you will need to adjust a bit the backend. Let me explain:&lt;/P&gt;
&lt;P&gt;First, I'm using the following example data.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daniel_Castella_0-1764165988966.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/185269i39FE944BEE91DFC6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daniel_Castella_0-1764165988966.png" alt="Daniel_Castella_0-1764165988966.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, in the backend I apply this code:&lt;/P&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;A:&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;LOAD&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; MaxMonthFlag,&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; '0' as PreviousYearFlag,&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; SelectedYear,&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; "Month",&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; Sales&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;FROM [lib://DataFiles/months.xlsx]&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;(ooxml, embedded labels, table is Sheet1);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;MAP:&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;Mapping&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;Load SelectedYear&amp;amp;"Month",&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt; &amp;nbsp; '1' as Flag&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;Resident A&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;where MaxMonthFlag=1;&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;Concatenate (A)&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;LOAD&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt; Applymap('MAP', (SelectedYear + 1)&amp;amp;Month, '-') as MaxMonthFlag,&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; '1' as PreviousYearFlag,&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; SelectedYear + 1 as SelectedYear,&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; "Month",&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; Sales&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;FROM [lib://DataFiles/months.xlsx]&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2" color="#808080"&gt;&lt;EM&gt;(ooxml, embedded labels, table is Sheet1);&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Finally in front end, a simple set analysis that you can see in the image below; together with the expected results:&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daniel_Castella_1-1764166076959.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/185270iC5B38813342F4ABD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daniel_Castella_1-1764166076959.png" alt="Daniel_Castella_1-1764166076959.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use a mapping to reassign the Flag to the proper month while I'm concatenating the previous year data to the current year data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if it helps you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 26 Nov 2025 14:10:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Max-completed-Month-current-vs-previous-year/m-p/2537320#M108791</guid>
      <dc:creator>Daniel_Castella</dc:creator>
      <dc:date>2025-11-26T14:10:28Z</dc:date>
    </item>
  </channel>
</rss>

