<?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: Issue with storing date as a variable to be used in set analysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288517#M27151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about if you remove the first SnapDate... I should have seen this before and removed that...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum({&amp;lt;SnapDate={&lt;STRONG style="font-style: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-size: 14pt; color: #ff0000;"&gt;"&lt;/STRONG&gt;&lt;/STRONG&gt;$(=vPriorMonth)&lt;STRONG style="font-style: inherit; font-size: 14pt; color: #ff0000;"&gt;"&lt;/STRONG&gt;}&amp;gt;}MonthEndBalance)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Feb 2017 10:14:45 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2017-02-06T10:14:45Z</dc:date>
    <item>
      <title>Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288513#M27147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have created a variable to store the prior month that user selects.&lt;/P&gt;&lt;P&gt;vPriorMonth =&amp;nbsp; Date(addmonths(MonthStart(SnapDate),-1),'MMM-YY')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Purpose is to show the previous month's balance if a month is selected.&lt;/P&gt;&lt;P&gt;eg. User select SnapDate = Jul-16&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following expression will generate these outputs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(vPriorMonth)&amp;nbsp; =&amp;gt; Jun-16&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;SnapDate=, SnapDate={'Jun-16'}&amp;gt;}MonthEndBalance) =&amp;gt; The correct balance if I hardcoded it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;SnapDate=, SnapDate={'$(vPriorMonth)'}&amp;gt;}MonthEndBalance)&amp;nbsp; =&amp;gt; No results&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;SnapDate=, SnapDate={$(=vPriorMonth)}&amp;gt;}MonthEndBalance)&amp;nbsp; =&amp;gt;&amp;nbsp; =&amp;gt; No results&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have narrowed it down to the issue is that it is a date field as I have replaced the date check with a unrelated check and the code works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to get the set analysis to work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additional info, not too sure if it helps.&lt;/P&gt;&lt;P&gt;The date format in the load editor:&lt;/P&gt;&lt;P&gt;SET DateFormat='DDMMMYYYY';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How SnapDate is loaded:&lt;/P&gt;&lt;P&gt;Date(MonthStart(SNAP_DATE),'MMM-YY') AS SnapDate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2017 06:29:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288513#M27147</guid>
      <dc:creator />
      <dc:date>2017-02-03T06:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288514#M27148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about this:&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;&lt;STRONG&gt;Sum({&amp;lt;SnapDate=, SnapDate={&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG style=": ; color: #ff0000; font-size: 14pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;"&lt;/STRONG&gt;&lt;/STRONG&gt;$(=vPriorMonth)&lt;STRONG style=": ; color: #ff0000; font-size: 14pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;"&lt;/STRONG&gt;}&amp;gt;}MonthEndBalance) &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2017 10:19:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288514#M27148</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-02-03T10:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288515#M27149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That doesn't return any result as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 01:33:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288515#M27149</guid>
      <dc:creator />
      <dc:date>2017-02-06T01:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288516#M27150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Melvin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please use below given sample code snippet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14863757751335147 jive_text_macro" jivemacro_uid="_14863757751335147"&gt;
&lt;P style="font-size: 13.3333px;"&gt;//Definition of &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;vPriorMonth&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;Date(addmonths(MonthStart(Max(SnapDate)),-1),'MMM-YY')&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;//Expression to calculate Previous Month Balance&lt;/P&gt;
&lt;P style="font-size: 13.3333px;"&gt;Sum({&amp;lt;SnapDate=, SnapDate={"=$(vPriorMonth)"}&amp;gt;}MonthEndBalance)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 10:10:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288516#M27150</guid>
      <dc:creator>rahulpawarb</dc:creator>
      <dc:date>2017-02-06T10:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288517#M27151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about if you remove the first SnapDate... I should have seen this before and removed that...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum({&amp;lt;SnapDate={&lt;STRONG style="font-style: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-size: 14pt; color: #ff0000;"&gt;"&lt;/STRONG&gt;&lt;/STRONG&gt;$(=vPriorMonth)&lt;STRONG style="font-style: inherit; font-size: 14pt; color: #ff0000;"&gt;"&lt;/STRONG&gt;}&amp;gt;}MonthEndBalance)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 10:14:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288517#M27151</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-02-06T10:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288518#M27152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;//Expression &lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; background-color: inherit; font-size: 9pt !important;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt; calculate Previous &lt;/SPAN&gt;&lt;SPAN class="func" style="font-weight: inherit; font-style: inherit; color: #ff1493; background-color: inherit; font-size: 9pt !important;"&gt;Month&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt; Balance&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&lt;SPAN class="func" style="font-weight: inherit; font-style: inherit; color: #ff1493; background-color: inherit; font-size: 9pt !important;"&gt;Sum&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;({&amp;lt;SnapDate=, SnapDate={&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; background-color: inherit; font-size: 9pt !important;"&gt;"=$(vPriorMonth)"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;}&amp;gt;}MonthEndBalance)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-weight: inherit;"&gt;This gives the current month's balance instead of prior months balance. Could it be that the expression is not evaluated?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 10:48:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288518#M27152</guid>
      <dc:creator />
      <dc:date>2017-02-06T10:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288519#M27153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum({&amp;lt;SnapDate={&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-size: 14pt; font-family: inherit; color: #ff0000;"&gt;"&lt;/STRONG&gt;&lt;/STRONG&gt;$(=vPriorMonth)&lt;STRONG style="font-style: inherit; font-size: 14pt; font-family: inherit; color: #ff0000;"&gt;"&lt;/STRONG&gt;}&amp;gt;}MonthEndBalance)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;After removing the first SnapDate, expression is still returning 0. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 10:50:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288519#M27153</guid>
      <dc:creator />
      <dc:date>2017-02-06T10:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288520#M27154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Melvin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please share the application with sample data? This will help us to do the root cause analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 13:02:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288520#M27154</guid>
      <dc:creator>rahulpawarb</dc:creator>
      <dc:date>2017-02-06T13:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288521#M27155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would you be able to share a sample to look at this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 22:15:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288521#M27155</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-02-06T22:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288522#M27156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have attached a sample to the original post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2017 03:56:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288522#M27156</guid>
      <dc:creator />
      <dc:date>2017-02-07T03:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with storing date as a variable to be used in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288523#M27157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you using SnapDate as a dimension and you are hoping to get the prior month by row?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, you cannot use a set expression - the set expression is evaluated for the table as a whole, and not on a row by row basis. For this case, use a Sum(If(..)) expression or create a derived prior month field in your load script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, use an aggregate function like Max(..) in your variable definition to ensure that it can be evaluated at a global level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Als, you cannot refer to the same field twice in the set expression. If you do, the first refreence will be ignored. So the first reference to SnapDate in &lt;EM&gt;Sum({&amp;lt;&lt;STRONG&gt;SnapDate=&lt;/STRONG&gt;, SnapDate={'$(vPriorMonth...&lt;/EM&gt; will be ignored and clutters your expression for no purpose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2017 05:15:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Issue-with-storing-date-as-a-variable-to-be-used-in-set-analysis/m-p/1288523#M27157</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2017-02-07T05:15:48Z</dc:date>
    </item>
  </channel>
</rss>

