<?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 How to use fields from different tables in set expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-use-fields-from-different-tables-in-set-expression/m-p/856036#M300052</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello QlikView Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to QlikView and developing an application to load sales data for one company.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scenario I am working on is this:- &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is &lt;STRONG&gt;order_header&lt;/STRONG&gt; table that mainly contains fields: orderdate, amount, id, itemname. Using the various date functions I have derived &lt;SPAN style="text-decoration: underline;"&gt;Year&lt;/SPAN&gt;, Month Date from this field. (Right now not using a Separate Calendar Table). Now, I have one small table : &lt;STRONG&gt;Season&lt;/STRONG&gt; that contains 4 columns:-&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;Year&lt;/SPAN&gt;, SeasonType, SeasonStartDate and SeasonCloseDate. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you see the two column are linked on the column: Year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I want to be able to get the sum or amount for the selected year but for orderdate &amp;gt;= SeasonStartDate&amp;nbsp; and orderdate &amp;lt;= SeasonCloseDate. None of the below 3 Set expression I came up with is working. I am sure I am missing something here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;Year={"$(=max(Year))"},SeasonType = {'Summer'}, &lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt; = {"$(=max(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt;))"}, &lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt; = {"$(=max(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt;))"}&amp;gt;}amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;Year={"$(=max(Year))"},SeasonType = {'Summer'}, &lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt; = {"$(=(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt;))"}, &lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt; = {"$(=(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt;))"}&amp;gt;}amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Sum({$&amp;lt;Year={"$(=max(Year))"},SeasonType = {'Summer'}, &lt;/SPAN&gt;OrderDate={"&amp;gt;=$(=min(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt;)) &amp;lt;=$(=&lt;SPAN style="font-size: 13.3333330154419px;"&gt;min(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;)&lt;/SPAN&gt;)"}&amp;gt;}amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(not sure if we can we even compare OrderDate field directly to the SeasonStartDate ? as in the above expression?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;I have tried some other set expressions too&amp;nbsp; but in vain.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope my explanation is clear. Any ideas please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tx&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jun 2015 18:18:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-06-18T18:18:14Z</dc:date>
    <item>
      <title>How to use fields from different tables in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-fields-from-different-tables-in-set-expression/m-p/856036#M300052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello QlikView Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to QlikView and developing an application to load sales data for one company.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scenario I am working on is this:- &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is &lt;STRONG&gt;order_header&lt;/STRONG&gt; table that mainly contains fields: orderdate, amount, id, itemname. Using the various date functions I have derived &lt;SPAN style="text-decoration: underline;"&gt;Year&lt;/SPAN&gt;, Month Date from this field. (Right now not using a Separate Calendar Table). Now, I have one small table : &lt;STRONG&gt;Season&lt;/STRONG&gt; that contains 4 columns:-&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;Year&lt;/SPAN&gt;, SeasonType, SeasonStartDate and SeasonCloseDate. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you see the two column are linked on the column: Year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I want to be able to get the sum or amount for the selected year but for orderdate &amp;gt;= SeasonStartDate&amp;nbsp; and orderdate &amp;lt;= SeasonCloseDate. None of the below 3 Set expression I came up with is working. I am sure I am missing something here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;Year={"$(=max(Year))"},SeasonType = {'Summer'}, &lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt; = {"$(=max(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt;))"}, &lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt; = {"$(=max(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt;))"}&amp;gt;}amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;Year={"$(=max(Year))"},SeasonType = {'Summer'}, &lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt; = {"$(=(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt;))"}, &lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt; = {"$(=(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt;))"}&amp;gt;}amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Sum({$&amp;lt;Year={"$(=max(Year))"},SeasonType = {'Summer'}, &lt;/SPAN&gt;OrderDate={"&amp;gt;=$(=min(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonStartDate&lt;/SPAN&gt;)) &amp;lt;=$(=&lt;SPAN style="font-size: 13.3333330154419px;"&gt;min(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;SeasonCloseDate&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;)&lt;/SPAN&gt;)"}&amp;gt;}amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(not sure if we can we even compare OrderDate field directly to the SeasonStartDate ? as in the above expression?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;I have tried some other set expressions too&amp;nbsp; but in vain.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope my explanation is clear. Any ideas please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tx&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 18:18:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-fields-from-different-tables-in-set-expression/m-p/856036#M300052</guid>
      <dc:creator />
      <dc:date>2015-06-18T18:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use fields from different tables in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-fields-from-different-tables-in-set-expression/m-p/856037#M300053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try removing the quotes around the $(=max(Year)). You should not need those.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assume both OrderDate and SeasonStartDate are effectively numbers (as dates are in Qlik), you can compare these different fields directly with each other.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No clue how many SeasonTypes you have, but if it is a low number, you could consider flagging all (Order)Dates for the specific seasons which might make your Set Analysis statements less complex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without having an actual look at (example) data, I fear I cant help you much more at this moment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 20:39:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-fields-from-different-tables-in-set-expression/m-p/856037#M300053</guid>
      <dc:creator>oknotsen</dc:creator>
      <dc:date>2015-06-18T20:39:22Z</dc:date>
    </item>
  </channel>
</rss>

