<?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: Total units previous Period in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Total-units-previous-Period/m-p/1154683#M634013</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One possibility is to generate an AsOf table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;AsOf Month Year,Month Type,Month Year&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Apr-2016,Selected,Apr-2016&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Apr-2016,Previous,Mar-2016&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Mar-2016,Selected,Mar-2016&lt;BR /&gt;Mar-2016,Previous,Feb-2016&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Use Month Type as a dimension in your chart, sum(Units) as your expression. No variables, no set analysis, all complexity in the script instead of the chart, which is where I prefer to keep it when practical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This may not be the right solution for your specific requirement. Like the chart I suggest doesn't make it easy to then, say, add the difference in units between the months as another column. You might handle that by removing the Month Type dimension and having three expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Selected = sum({&amp;lt;[Month Type]={'Selected'}&amp;gt;} Units)&lt;BR /&gt;Previous = sum({&amp;lt;[Month Type]={'Previous'}&amp;gt;} Units)&lt;BR /&gt;Difference = Selected - Previous&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Or you could go nuts and handle that in script too:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;AsOf Month Year,Month Type,Month Year,Sign&lt;BR /&gt;Apr-2016,Selected,Apr-2016,+1&lt;BR /&gt;Apr-2016,Previous,Mar-2016,+1&lt;BR /&gt;Apr-2016,Difference,Apr-2016,+1&lt;BR /&gt;Apr-2016,Difference,Mar-2016,-1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add the Month Type back in as a dimension, and change the expression to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;sum(Sign * Units)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I probably wouldn't go that far, but maybe I would. It would depend on the situation I guess.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jun 2016 20:39:11 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2016-06-20T20:39:11Z</dc:date>
    <item>
      <title>Total units previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Total-units-previous-Period/m-p/1154682#M634012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a requirement where I need to create a Current period and Previous period showcase on my App.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Total Units for Selected Period I`m using =sum(Units)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Select Period is derived from Fiscal Year &amp;amp; Quarters.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So based on what my user would select as Currently period, I`d also want to show the same Data for previous period. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IS this what I need to do ?&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; &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 style="font-style: inherit; font-family: inherit;"&gt;set vPriorMonthYear = =Date(addmonths(max([Month Year]), -1), 'MMM-YYYY');&lt;/STRONG&gt;&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;And then the expressions for the current month and prior month columns is:&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 style="font-style: inherit; font-family: inherit;"&gt;Sum({&amp;lt;[Month Year]={'$(vPriorMonthYear)'},Year=,Month=,Date=&amp;gt;}Units)&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 style="font-style: inherit; font-family: inherit;"&gt;&lt;BR /&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 style="font-style: inherit; font-family: inherit;"&gt;Can someone help me with this ??&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 style="font-style: inherit; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 14:43:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Total-units-previous-Period/m-p/1154682#M634012</guid>
      <dc:creator />
      <dc:date>2016-06-20T14:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Total units previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Total-units-previous-Period/m-p/1154683#M634013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One possibility is to generate an AsOf table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;AsOf Month Year,Month Type,Month Year&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Apr-2016,Selected,Apr-2016&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Apr-2016,Previous,Mar-2016&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Mar-2016,Selected,Mar-2016&lt;BR /&gt;Mar-2016,Previous,Feb-2016&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Use Month Type as a dimension in your chart, sum(Units) as your expression. No variables, no set analysis, all complexity in the script instead of the chart, which is where I prefer to keep it when practical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This may not be the right solution for your specific requirement. Like the chart I suggest doesn't make it easy to then, say, add the difference in units between the months as another column. You might handle that by removing the Month Type dimension and having three expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Selected = sum({&amp;lt;[Month Type]={'Selected'}&amp;gt;} Units)&lt;BR /&gt;Previous = sum({&amp;lt;[Month Type]={'Previous'}&amp;gt;} Units)&lt;BR /&gt;Difference = Selected - Previous&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Or you could go nuts and handle that in script too:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;AsOf Month Year,Month Type,Month Year,Sign&lt;BR /&gt;Apr-2016,Selected,Apr-2016,+1&lt;BR /&gt;Apr-2016,Previous,Mar-2016,+1&lt;BR /&gt;Apr-2016,Difference,Apr-2016,+1&lt;BR /&gt;Apr-2016,Difference,Mar-2016,-1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add the Month Type back in as a dimension, and change the expression to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;sum(Sign * Units)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I probably wouldn't go that far, but maybe I would. It would depend on the situation I guess.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 20:39:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Total-units-previous-Period/m-p/1154683#M634013</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2016-06-20T20:39:11Z</dc:date>
    </item>
  </channel>
</rss>

