<?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 Expression to display measure for previous month only in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Expression-to-display-measure-for-previous-month-only/m-p/2524195#M106858</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We have the following table:&lt;/P&gt;&lt;PRE&gt;messages:
LOAD
    country,
    message_count,
    client_cost,
    sent_month
FROM [lib://QVDFOLDER/messages.qvd] (qvd);&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;sent_month&lt;/STRONG&gt;&amp;nbsp;is a Date in format &lt;STRONG&gt;MMM YYYY&lt;/STRONG&gt;&amp;nbsp;(e.g. &lt;STRONG&gt;Jun 2025&lt;/STRONG&gt;) :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_3-1752518614268.png" style="width: 82px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182079i739693303F600A55/image-dimensions/82x186?v=v2" width="82" height="186" role="button" title="RoyBatty_3-1752518614268.png" alt="RoyBatty_3-1752518614268.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and&amp;nbsp;&lt;EM&gt;Data model viewer&lt;/EM&gt; shows the following tags:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_0-1752517530971.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182076i1A5293873A33BBE4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RoyBatty_0-1752517530971.png" alt="RoyBatty_0-1752517530971.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;On the sheet we added a table, and as the first column (dimension) we added &lt;STRONG&gt;country&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Now we want to add a new column (measure)&amp;nbsp;that will display &lt;FONT color="#000080"&gt;&lt;STRONG&gt;Sum([message_count])&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;STRONG&gt;for the previous month only&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We tried using the following expression:&lt;BR /&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;Sum({&amp;lt;[sent_month] = {"=$(Date(MonthStart(AddMonths(Today(), -1)), 'MMM YYYY'))"}&amp;gt;} message_count)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;But it doesn't work:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_1-1752518147551.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182077iE30B79FB36B54816/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RoyBatty_1-1752518147551.png" alt="RoyBatty_1-1752518147551.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We checked the data and there are messages that were sent in the previous month, but when we use the above expression - it shows an empty table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We tested this part of the expression by adding it to be a label - and it works:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;Date(MonthStart(AddMonths(Today(), -1)), 'MMM YYYY')&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_2-1752518379316.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182078i095D0701BEF693F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RoyBatty_2-1752518379316.png" alt="RoyBatty_2-1752518379316.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you know why the above expression doesn't work, what might need to be changed to make it work?&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jul 2025 18:48:35 GMT</pubDate>
    <dc:creator>RoyBatty</dc:creator>
    <dc:date>2025-07-14T18:48:35Z</dc:date>
    <item>
      <title>Expression to display measure for previous month only</title>
      <link>https://community.qlik.com/t5/App-Development/Expression-to-display-measure-for-previous-month-only/m-p/2524195#M106858</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We have the following table:&lt;/P&gt;&lt;PRE&gt;messages:
LOAD
    country,
    message_count,
    client_cost,
    sent_month
FROM [lib://QVDFOLDER/messages.qvd] (qvd);&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;sent_month&lt;/STRONG&gt;&amp;nbsp;is a Date in format &lt;STRONG&gt;MMM YYYY&lt;/STRONG&gt;&amp;nbsp;(e.g. &lt;STRONG&gt;Jun 2025&lt;/STRONG&gt;) :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_3-1752518614268.png" style="width: 82px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182079i739693303F600A55/image-dimensions/82x186?v=v2" width="82" height="186" role="button" title="RoyBatty_3-1752518614268.png" alt="RoyBatty_3-1752518614268.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and&amp;nbsp;&lt;EM&gt;Data model viewer&lt;/EM&gt; shows the following tags:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_0-1752517530971.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182076i1A5293873A33BBE4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RoyBatty_0-1752517530971.png" alt="RoyBatty_0-1752517530971.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;On the sheet we added a table, and as the first column (dimension) we added &lt;STRONG&gt;country&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Now we want to add a new column (measure)&amp;nbsp;that will display &lt;FONT color="#000080"&gt;&lt;STRONG&gt;Sum([message_count])&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;STRONG&gt;for the previous month only&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We tried using the following expression:&lt;BR /&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;Sum({&amp;lt;[sent_month] = {"=$(Date(MonthStart(AddMonths(Today(), -1)), 'MMM YYYY'))"}&amp;gt;} message_count)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;But it doesn't work:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_1-1752518147551.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182077iE30B79FB36B54816/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RoyBatty_1-1752518147551.png" alt="RoyBatty_1-1752518147551.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We checked the data and there are messages that were sent in the previous month, but when we use the above expression - it shows an empty table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We tested this part of the expression by adding it to be a label - and it works:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;Date(MonthStart(AddMonths(Today(), -1)), 'MMM YYYY')&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_2-1752518379316.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182078i095D0701BEF693F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RoyBatty_2-1752518379316.png" alt="RoyBatty_2-1752518379316.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you know why the above expression doesn't work, what might need to be changed to make it work?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2025 18:48:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Expression-to-display-measure-for-previous-month-only/m-p/2524195#M106858</guid>
      <dc:creator>RoyBatty</dc:creator>
      <dc:date>2025-07-14T18:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to display measure for previous month only</title>
      <link>https://community.qlik.com/t5/App-Development/Expression-to-display-measure-for-previous-month-only/m-p/2524201#M106859</link>
      <description>&lt;P&gt;Try this may be -&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;[sent_month] = {"=$(&lt;FONT size="6"&gt;=&lt;/FONT&gt;Date(MonthStart(AddMonths(Today(), -1)), 'MMM YYYY'))"}&amp;gt;} message_count)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check in the expression editor at the bottom, it should show right value of the expression used in sent_month.&lt;/P&gt;&lt;P&gt;Somehow formatting should match between data model value and the value resulting from the above expression. Check for decimal component in the date as well, sometimes that causes the mismatch.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2025 21:25:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Expression-to-display-measure-for-previous-month-only/m-p/2524201#M106859</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2025-07-14T21:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to display measure for previous month only</title>
      <link>https://community.qlik.com/t5/App-Development/Expression-to-display-measure-for-previous-month-only/m-p/2524281#M106868</link>
      <description>&lt;P&gt;I tried that&amp;nbsp;&amp;nbsp;and now the editor shows &lt;EM&gt;June 2025&amp;nbsp;&lt;/EM&gt;(please ignore the "&lt;EM&gt;msg.&lt;/EM&gt;" prefix - I've excluded it here for simplicity):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_0-1752583534562.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182104i1F50EB96870FCEEC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RoyBatty_0-1752583534562.png" alt="RoyBatty_0-1752583534562.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;but for some reason it still doesn't work:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RoyBatty_1-1752583719834.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/182105i71F8F57A172BAD33/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RoyBatty_1-1752583719834.png" alt="RoyBatty_1-1752583719834.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 12:55:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Expression-to-display-measure-for-previous-month-only/m-p/2524281#M106868</guid>
      <dc:creator>RoyBatty</dc:creator>
      <dc:date>2025-07-15T12:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to display measure for previous month only</title>
      <link>https://community.qlik.com/t5/App-Development/Expression-to-display-measure-for-previous-month-only/m-p/2524283#M106870</link>
      <description>&lt;P&gt;This works (the problem was with the quotes):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;[sent_month] = {"$(=Date(MonthStart(AddMonths(Today(), -1)), 'MMM YYYY'))"}&amp;gt;} message_count)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(and also with missing "="... Thanks &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/48860"&gt;@Digvijay_Singh&lt;/a&gt;&amp;nbsp;!)&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 13:03:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Expression-to-display-measure-for-previous-month-only/m-p/2524283#M106870</guid>
      <dc:creator>RoyBatty</dc:creator>
      <dc:date>2025-07-15T13:03:57Z</dc:date>
    </item>
  </channel>
</rss>

