<?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: Dimension is MonthYear: How to count for the previous month? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Dimension-is-MonthYear-How-to-count-for-the-previous-month/m-p/2136663#M92377</link>
    <description>&lt;P&gt;Hi, Set analysis is applied before calculating the table, so it doen't uses the dimension value.&lt;/P&gt;
&lt;P&gt;The access the upper row you can use Above() function:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense/August2023/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/above.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense/August2023/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/above.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Other solutions might be:&lt;/P&gt;
&lt;P&gt;- Use an as-of calendar&lt;/P&gt;
&lt;P&gt;- Create additional rows for past months so you can use an expression like Count(...[%_user_id_prev_month]).&lt;/P&gt;
&lt;P&gt;- Have the data precalculated&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2023 10:44:51 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2023-11-10T10:44:51Z</dc:date>
    <item>
      <title>Dimension is MonthYear: How to count for the previous month?</title>
      <link>https://community.qlik.com/t5/App-Development/Dimension-is-MonthYear-How-to-count-for-the-previous-month/m-p/2136474#M92355</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have the following data (just one table):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="J30Ti" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/119673i22B098423392DE61/image-size/large?v=v2&amp;amp;px=999" role="button" title="J30Ti" alt="J30Ti" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And on sheet I want to create a table that will have &lt;CODE&gt;MonthYear&lt;/CODE&gt; as dimension and two measures:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;Current&lt;/CODE&gt;: Counts distinct users that had &lt;CODE&gt;Activity = "Payment"&lt;/CODE&gt;. Expression for this is: &lt;CODE&gt;Count({&amp;lt;[Activity]={'Payment'}&amp;gt;} distinct [%_user_id])&lt;/CODE&gt; and it works fine.&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;Previous&lt;/CODE&gt;: Counts distinct users that had &lt;CODE&gt;Activity = "Payment"&lt;/CODE&gt; &lt;STRONG&gt;during previous month&lt;/STRONG&gt;. For example, if the value of the &lt;CODE&gt;MonthYear&lt;/CODE&gt; dimension is &lt;CODE&gt;Feb 2023&lt;/CODE&gt;, then it should show count for the &lt;CODE&gt;Jan 2023&lt;/CODE&gt;. Or, for &lt;CODE&gt;Jan 2023&lt;/CODE&gt; it should show count for &lt;CODE&gt;Dec 2022&lt;/CODE&gt; ...&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kLs5M" style="width: 977px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/119674i1B4B685D3B0AE6F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="kLs5M" alt="kLs5M" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Do you know what the expression for the &lt;CODE&gt;Previous&lt;/CODE&gt; measure would be?&lt;/P&gt;
&lt;P&gt;I tried this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Count({&amp;lt;MonthYear={'$(=Date(AddMonths(MonthYear, -1), 'MMM YYYY'))'}, [Activity]={'Payment'}&amp;gt;} distinct [%_user_id])
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but it does not work.&lt;/P&gt;
&lt;P&gt;Maybe such a measure is not possible in this particular case?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 23:33:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dimension-is-MonthYear-How-to-count-for-the-previous-month/m-p/2136474#M92355</guid>
      <dc:creator>RoyBatty</dc:creator>
      <dc:date>2023-11-09T23:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dimension is MonthYear: How to count for the previous month?</title>
      <link>https://community.qlik.com/t5/App-Development/Dimension-is-MonthYear-How-to-count-for-the-previous-month/m-p/2136663#M92377</link>
      <description>&lt;P&gt;Hi, Set analysis is applied before calculating the table, so it doen't uses the dimension value.&lt;/P&gt;
&lt;P&gt;The access the upper row you can use Above() function:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense/August2023/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/above.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense/August2023/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/above.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Other solutions might be:&lt;/P&gt;
&lt;P&gt;- Use an as-of calendar&lt;/P&gt;
&lt;P&gt;- Create additional rows for past months so you can use an expression like Count(...[%_user_id_prev_month]).&lt;/P&gt;
&lt;P&gt;- Have the data precalculated&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 10:44:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dimension-is-MonthYear-How-to-count-for-the-previous-month/m-p/2136663#M92377</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-11-10T10:44:51Z</dc:date>
    </item>
  </channel>
</rss>

