<?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 Set Analysis with Variables trouble in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Variables-trouble/m-p/184468#M501841</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The variables also need a dollar sign expansion and don't remember having much luck nesting $($()) so I would combine the 2 variables into one do the following:&lt;/P&gt;&lt;P&gt;OrderDate = {"&amp;lt;=$(vStartDateLastYear_vDaysToShow)"}&amp;gt;}&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Nov 2010 16:25:37 GMT</pubDate>
    <dc:creator>pover</dc:creator>
    <dc:date>2010-11-12T16:25:37Z</dc:date>
    <item>
      <title>Set Analysis with Variables trouble</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Variables-trouble/m-p/184467#M501840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm sure I have come close to solving this with the help of existing forum posts, but I can't quite seem to get it working. After 2 solid days of trying I'm calling out for help!!&lt;/P&gt;&lt;P&gt;I have two tables:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table1&lt;/STRONG&gt; - Show_ID, ShowYear, ShowName, ShowStartDate&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table2&lt;/STRONG&gt; - Show_ID, OrderDate, SaleValue&lt;/P&gt;&lt;P&gt;These tables are obviously linked on Show_ID (unique for each show in each year).&lt;/P&gt;&lt;P&gt;I have a variable vDaysToShow -&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;=IF(IsNull(Only(Show_ID)),'&amp;lt;Select 1 Show&amp;gt;', (ShowStartDate-Today()))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;What I'm trying to achieve is this - When you select a ShowName and ShowYear (unique Show_ID) I want to show total sales for the selected year vs sales at this point last year, i.e. ShowStartDate - vDaysToShow&lt;/P&gt;&lt;P&gt;E.g. Selected ShowName is &lt;B&gt;ClothesShowLive&lt;/B&gt;, selected ShowYear is &lt;B&gt;2010&lt;/B&gt;. This year it starts on 03/12/2010 - 22 days from now. Last year it started 04/12/2009. I need to see the total sales so far for this year (easy -&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;SUM(SaleValue)&lt;/PRE&gt;), but I also want to see total sales for 22 days before the ShowStartDate, last year. &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I've tried all sorts...&lt;/P&gt;&lt;P&gt;I can get the total sales for last year easily enough:&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;=SUM( {$&amp;lt;ShowYear = {$(#=Only(ShowYear)-1)}&amp;gt;} SaleValue )&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;and I can hard-code the date limit:&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;=SUM( {$&amp;lt;ShowYear = {$(#=Only(ShowYear)-1)}, OrderDate = {"&amp;lt;=12/11/2009"}&amp;gt;} SaleValue )&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I need the OrderDate bit above to be &amp;lt;= StartDateLastYear - vDaysToShow, basically! So I started by creating a variable vStartDateLastYear:&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;=DATE(ONLY( {$&amp;lt;ShowYear = {$(#=Only(ShowYear)-1)}&amp;gt;} StartDate),'DD/MM/YYYY')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;and then tried loads of ways of getting that into the equation e.g.&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;=SUM( {$&amp;lt;Show Year = {$(#=Only(ShowYear)-1)}, OrderDate = {(vStartDateLastYear - vDaysToShow)}&amp;gt;} SaleValue])&lt;/PRE&gt;but just can't get it to work!&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Please help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 12:39:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Variables-trouble/m-p/184467#M501840</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2010-11-12T12:39:05Z</dc:date>
    </item>
    <item>
      <title>Set Analysis with Variables trouble</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Variables-trouble/m-p/184468#M501841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The variables also need a dollar sign expansion and don't remember having much luck nesting $($()) so I would combine the 2 variables into one do the following:&lt;/P&gt;&lt;P&gt;OrderDate = {"&amp;lt;=$(vStartDateLastYear_vDaysToShow)"}&amp;gt;}&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 16:25:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Variables-trouble/m-p/184468#M501841</guid>
      <dc:creator>pover</dc:creator>
      <dc:date>2010-11-12T16:25:37Z</dc:date>
    </item>
    <item>
      <title>Set Analysis with Variables trouble</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Variables-trouble/m-p/184469#M501842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Karl - you are an absolute legend. Thank you mate - worked perfectly! Final expression looks like this:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;=SUM( {$&amp;lt;[Show Year] = {$(#=Only([Show Year])-1)}, [Order Date] = {"&amp;lt;$(vTodayLastYear)"}&amp;gt;} [Sale Value] )&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;(Happy) Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 21:02:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Variables-trouble/m-p/184469#M501842</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2010-11-12T21:02:54Z</dc:date>
    </item>
  </channel>
</rss>

