<?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: expression for dynamic dimension in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567299#M211573</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set analysis in the expression will limit what is given in the dimensions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my example, the dimension in my chart is the field Month, and my expression is:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;month_ID={'&amp;gt;=$(=max(month_ID)-6)&amp;lt;=$(=max(month_ID))'},Month=&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The set expression limits my dimensions as you can see in this screenshot (the raw data is on the left and the chart with the set expression is on the right):&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="52072" alt="" class="jiveImage" src="https://community.qlik.com/legacyfs/online/52072_pastedImage_2.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: If you wanted to do it in the dimension without using set analysis, you could use this:&lt;/P&gt;&lt;P&gt;=aggr(if(month_ID &amp;gt;= $(=max(month_ID))-6 and month_ID &amp;lt;= $(=max(month_ID)),Month), Month)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I would recommend using the set analysis in the expression over this.&amp;nbsp; Performance with set analysis is better than using an if statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jan 2014 20:13:20 GMT</pubDate>
    <dc:creator>Nicole-Smith</dc:creator>
    <dc:date>2014-01-24T20:13:20Z</dc:date>
    <item>
      <title>expression for dynamic dimension</title>
      <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567291#M211565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My user wants to select a certain month and see values from the last 6 months in relation to the selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thought a dynamic dimension would be the solution but found out that I wasn't able to create an expression that would return me the needed list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;P&gt;selected month_ID = 1250&lt;/P&gt;&lt;P&gt;dynamic dimension for month_ID = 1244..1250&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juerg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 15:43:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567291#M211565</guid>
      <dc:creator />
      <dc:date>2014-01-24T15:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: expression for dynamic dimension</title>
      <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567292#M211566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you have an ascending ID associated to every month it is enough to do ID&amp;gt;=1250-6 and ID&amp;lt;=1250&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 15:45:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567292#M211566</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-01-24T15:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: expression for dynamic dimension</title>
      <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567293#M211567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;YearMonthNum={"&amp;gt;$(=max(addmonths(YearMonthNum),-6)) &amp;lt;=$(=max(YearMonthNum))"}&amp;gt;} value)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 15:46:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567293#M211567</guid>
      <dc:creator />
      <dc:date>2014-01-24T15:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: expression for dynamic dimension</title>
      <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567294#M211568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See the set analysis in the expression in the attached example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 15:54:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567294#M211568</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2014-01-24T15:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: expression for dynamic dimension</title>
      <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567295#M211569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SUM({&amp;lt;Month_ID= {"&amp;gt;=$(=Max(Month_ID)-5)&amp;lt;=$(=Max(Month_ID))"}&amp;gt;}SalesValue)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 15:57:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567295#M211569</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2014-01-24T15:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Re: expression for dynamic dimension</title>
      <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567296#M211570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I noticed you used 'single quotes' instead of "double quotes".&amp;nbsp; Is there a particular reason or is there any scenarios where it would matter which one you used?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;month_ID={&lt;SPAN style="color: #ff0000; text-decoration: line-through;"&gt;'&lt;/SPAN&gt;&amp;gt;=$(=max(month_ID)-6)&amp;lt;=$(=max(month_ID))&lt;SPAN style="color: #ff0000;"&gt;'&lt;/SPAN&gt;},Month=&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; instead of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;month_ID={&lt;SPAN style="color: #ff0000;"&gt;"&lt;/SPAN&gt;&amp;gt;=$(=max(month_ID)-6)&amp;lt;=$(=max(month_ID))&lt;SPAN style="color: #ff0000;"&gt;"&lt;/SPAN&gt;},Month=&amp;gt;}Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 16:07:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567296#M211570</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-24T16:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Re: expression for dynamic dimension</title>
      <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567297#M211571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use single quotes as long as you don't have single quotes within the single quotes.&amp;nbsp; For my original calculation, both single and double quotes can be used, but if we had something like the following, double quotes would need to be used on the outside since single quotes are used on the inside:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;sum({&amp;lt;month_ID={"&amp;gt;=$(=max({&amp;lt;ID={'001'}&amp;gt;}month_ID)-6)&amp;lt;=$(=max({&amp;lt;ID={'001'}&amp;gt;}month_ID))"},Month=&amp;gt;}Sales)&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 16:27:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567297#M211571</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2014-01-24T16:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: expression for dynamic dimension</title>
      <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567298#M211572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;wouw - many answers - great thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nicole - can't open your example, have only a private license at home.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general - all responses try to limit the expression result as I understand - and are not trying to create a reduced calculated dimension, meaning not all month-ID's but only a subrange of them?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried to find an option with Dimension limits but could not find options to meet my requirements. For me this would have been the most obvious place to limit dimensional values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The limited dimensional values in the Dimensions section would provide me with an easier to understand formula in the expressions section (set expressions are a pain to create and interprete [at least to me])?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or did I get things wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juerg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 20:09:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567298#M211572</guid>
      <dc:creator />
      <dc:date>2014-01-24T20:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: expression for dynamic dimension</title>
      <link>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567299#M211573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set analysis in the expression will limit what is given in the dimensions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my example, the dimension in my chart is the field Month, and my expression is:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;month_ID={'&amp;gt;=$(=max(month_ID)-6)&amp;lt;=$(=max(month_ID))'},Month=&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The set expression limits my dimensions as you can see in this screenshot (the raw data is on the left and the chart with the set expression is on the right):&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="52072" alt="" class="jiveImage" src="https://community.qlik.com/legacyfs/online/52072_pastedImage_2.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: If you wanted to do it in the dimension without using set analysis, you could use this:&lt;/P&gt;&lt;P&gt;=aggr(if(month_ID &amp;gt;= $(=max(month_ID))-6 and month_ID &amp;lt;= $(=max(month_ID)),Month), Month)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I would recommend using the set analysis in the expression over this.&amp;nbsp; Performance with set analysis is better than using an if statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 20:13:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expression-for-dynamic-dimension/m-p/567299#M211573</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2014-01-24T20:13:20Z</dc:date>
    </item>
  </channel>
</rss>

