<?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: Finding Previous Month Sales in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147005#M636069</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition you might need to add Date() function to your variables or into your set analysis directly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;vPreviousMonthMin = &lt;SPAN style="color: #ff0000;"&gt;Date(&lt;/SPAN&gt;Min({&amp;lt;Month={'$(=vPreviousMonthRD)'},Year={$(=vPreviousYearRD)}&amp;gt;}[Return Date])&lt;SPAN style="color: #ff0000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;, &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;'DateFieldFormat')&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;vPreviousMonthMax= &lt;SPAN style="color: #ff0000;"&gt;Date(&lt;/SPAN&gt;Max({&amp;lt;Month={'$(=vPreviousMonthRD)'},Year={$(=vPreviousYearRD)}&amp;gt;}[Return Date])&lt;SPAN style="color: #ff0000;"&gt;, &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #ff0000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;'DateFieldFormat')&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/4394"&gt;Dates in Set Analysis&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 May 2016 18:27:54 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-05-25T18:27:54Z</dc:date>
    <item>
      <title>Finding Previous Month Sales</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147002#M636066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having a problem in calculating the previous month sales value for&amp;nbsp; the adjusted sales.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="export.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/125783_export.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;in my data model I have used left join to join orders and returns table with Order ID, the return table is having (Order ID, Status, Return Date) what is need is to find the adjusted sales which means the (Total sales- total sales of the product that have been returned), so I am able to find the adjusted sales for current month but I am not able to find the adjusted sales for previous month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using these expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MinDate = Min([Return Date])&lt;/P&gt;&lt;P&gt;MaxDate= Max([Return Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vPreviousYearRD= Year(AddMonths(Date(MinDate),-1)) // to find the year&lt;/P&gt;&lt;P&gt;vPreviousMonthRD=Month(AddMonths(Date(MinDate),-1))// to find month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vPreviousMonthMin = Min({&amp;lt;Month={'$(=vPreviousMonthRD'},Year={$(=vPreviousYearRD)}&amp;gt;}[Return Date])&lt;/P&gt;&lt;P&gt;vPreviousMonthMax= Max({&amp;lt;Month={'$(=vPreviousMonthRD'},Year={$(=vPreviousYearRD)}&amp;gt;}[Return Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adjusted Sales= sum({&amp;lt;[Return Date] = {'&amp;gt;= $(=vPreviousMonthMin) &amp;lt;=$(=vPreviousMonthMax)'}&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I am using the filter of year and month which are generated using Order Date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can some one help me out in this please, it is urgent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vivek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2016 16:12:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147002#M636066</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-25T16:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Previous Month Sales</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147003#M636067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;vPreviousYearRD= Year(AddMonths(Date(MinDate),-1)) // to find the year&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;vPreviousMonthRD=Month(AddMonths(Date(MinDate),-1))// to find month&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Try using the MaxDate.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2016 17:14:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147003#M636067</guid>
      <dc:creator />
      <dc:date>2016-05-25T17:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Previous Month Sales</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147004#M636068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may need to clear user selections in the calendar fields to avoid an incompatible selection state in your set expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum({&amp;lt;[Return Date] = {'&amp;gt;= $(=vPreviousMonthMin) &amp;lt;=$(=vPreviousMonthMax)'}&lt;STRONG&gt;, [Order Date], Month, Year&lt;/STRONG&gt;&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2016 17:50:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147004#M636068</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-05-25T17:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Previous Month Sales</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147005#M636069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition you might need to add Date() function to your variables or into your set analysis directly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;vPreviousMonthMin = &lt;SPAN style="color: #ff0000;"&gt;Date(&lt;/SPAN&gt;Min({&amp;lt;Month={'$(=vPreviousMonthRD)'},Year={$(=vPreviousYearRD)}&amp;gt;}[Return Date])&lt;SPAN style="color: #ff0000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;, &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;'DateFieldFormat')&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;vPreviousMonthMax= &lt;SPAN style="color: #ff0000;"&gt;Date(&lt;/SPAN&gt;Max({&amp;lt;Month={'$(=vPreviousMonthRD)'},Year={$(=vPreviousYearRD)}&amp;gt;}[Return Date])&lt;SPAN style="color: #ff0000;"&gt;, &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #ff0000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;'DateFieldFormat')&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/4394"&gt;Dates in Set Analysis&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2016 18:27:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147005#M636069</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-25T18:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Previous Month Sales</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147006#M636070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I am using the expression Sum({&amp;lt;Month={'$(=vPreviousMonthRD)'},Year_RD={$(=vPreviousYearRD)}&amp;gt;}Sales) it is giving me the value for the selection made on year and month but if I select year=2010, month=jan it is giving me the value =0 , it should give me a value. How can I get it any suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vivek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2016 19:50:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147006#M636070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-25T19:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Previous Month Sales</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147007#M636071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you post a small sample app or at least post a complete scenario (like your selections you are doing, all resulting variable values, also the sample records that should be filtered by your set expression)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2016 20:23:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-Previous-Month-Sales/m-p/1147007#M636071</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-05-25T20:23:51Z</dc:date>
    </item>
  </channel>
</rss>

