<?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: Calculate Previous Month Cost based on filter selection in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Calculate-Previous-Month-Cost-based-on-filter-selection/m-p/2159739#M94048</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/149113"&gt;@MatheusC&lt;/a&gt;&amp;nbsp; !! The solution worked and the key to this is to ignore the month filter in the dashboard report which you mentioned. That really helped otherwise it was showing 2 entries (one for current month and another for the previous month).&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2024 19:22:00 GMT</pubDate>
    <dc:creator>satya_s</dc:creator>
    <dc:date>2024-01-09T19:22:00Z</dc:date>
    <item>
      <title>Calculate Previous Month Cost based on filter selection</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-Previous-Month-Cost-based-on-filter-selection/m-p/2159678#M94040</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am trying to show the month (selected) and previous month cost in a report but for some reason the previous month cost is showing the same value as current month. I need some help identify the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 1: Loading the data&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[DealsData]:&lt;BR /&gt;LOAD&lt;BR /&gt;Date(Floor(TRAFFIC_DATE),'YYYY-MM-DD') AS TRAFFIC_DATE,&lt;BR /&gt;"YEAR",&lt;BR /&gt;"MONTH",&lt;BR /&gt;CARRIER_SHORT_NAME,&lt;BR /&gt;SUM(COST) AS COST&lt;BR /&gt;FROM [lib://Du_QS_QVD_Folder_Conn/DealsData.qvd] (qvd)&lt;BR /&gt;GROUP BY Date(Floor(TRAFFIC_DATE),'YYYY-MM-DD'),&lt;BR /&gt;"YEAR",&lt;BR /&gt;"MONTH",&lt;BR /&gt;CARRIER_SHORT_NAME;&lt;/P&gt;
&lt;P&gt;Step 2:&lt;/P&gt;
&lt;P&gt;Created a calculated column in the sheet i.e.&lt;/P&gt;
&lt;P&gt;PREVIOUS_MONTH_COST = Sum({$&amp;lt;YEAR,MONTH, TRAFFIC_DATE={"=$(=Date(addmonths(Max(TRAFFIC_DATE),-1),'YYYY-MM'))"}&amp;gt;}COST)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 3: On selecting the Month and Year, the Previous Month Cost shows the same value as Current Month Cost&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="satya_s_2-1704814835039.png" style="width: 481px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/126753iD33ADA7EB879F5C9/image-dimensions/481x137?v=v2" width="481" height="137" role="button" title="satya_s_2-1704814835039.png" alt="satya_s_2-1704814835039.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;I tried the following formula too but that didn't work either&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;TRAFFIC_DATE={"&amp;gt;=$(=Date(MonthStart(addmonths(Max(TRAFFIC_DATE),-1)),'YYYY-MM-DD')) &amp;lt;=$(=Date(addmonths(Max(TRAFFIC_DATE),-1),'YYYY-MM-DD'))"},YEAR,MONTH&amp;gt;}COST)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="satya_s_1-1704814789831.png" style="width: 490px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/126752iB54928C357CEB0A6/image-dimensions/490x151?v=v2" width="490" height="151" role="button" title="satya_s_1-1704814789831.png" alt="satya_s_1-1704814789831.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please help rectify the expression above?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 15:42:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-Previous-Month-Cost-based-on-filter-selection/m-p/2159678#M94040</guid>
      <dc:creator>satya_s</dc:creator>
      <dc:date>2024-01-09T15:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Previous Month Cost based on filter selection</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-Previous-Month-Cost-based-on-filter-selection/m-p/2159705#M94044</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/95888"&gt;@satya_s&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;see with the formula below and ignoring &lt;STRONG&gt;month=&lt;/STRONG&gt; filter&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE id="tw-target-text" class="tw-data-text tw-text-large tw-ta" dir="ltr" data-placeholder="Tradução" data-ved="2ahUKEwj3lMya7tCDAxWzF7kGHTCpAxsQ3ewLegQIBRAQ"&gt;&lt;SPAN class="Y2IQFc"&gt;sum({&amp;lt;TRAFFIC_DATE={"&amp;gt;=$(=Date(MonthStart(Date(Max(TRAFFIC_DATE)),-1),'&lt;SPAN&gt;YYYY-MM-DD&lt;/SPAN&gt;')) &amp;lt;=$(=Date(MonthEnd(Date(Max (TRAFFIC_DATE)),-1),'&lt;SPAN&gt;YYYY-MM-DD&lt;/SPAN&gt;'))"},MONTH=&amp;gt;}COST)&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Att, Matheus&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 18:18:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-Previous-Month-Cost-based-on-filter-selection/m-p/2159705#M94044</guid>
      <dc:creator>MatheusC</dc:creator>
      <dc:date>2024-01-09T18:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Previous Month Cost based on filter selection</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-Previous-Month-Cost-based-on-filter-selection/m-p/2159739#M94048</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/149113"&gt;@MatheusC&lt;/a&gt;&amp;nbsp; !! The solution worked and the key to this is to ignore the month filter in the dashboard report which you mentioned. That really helped otherwise it was showing 2 entries (one for current month and another for the previous month).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 19:22:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-Previous-Month-Cost-based-on-filter-selection/m-p/2159739#M94048</guid>
      <dc:creator>satya_s</dc:creator>
      <dc:date>2024-01-09T19:22:00Z</dc:date>
    </item>
  </channel>
</rss>

