<?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 Create an Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241493#M91907</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;It's just an SQL writing issue, as ProductID field is present in both Product and SalesOrderDetail tables in your database, and you must specify in your SQL statement which of both you want to get&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;LOAD ProductID, StandardCost, OrderQty, num(StandardCost*OrderQty) as Cost;SQL SELECT OrderQty, &lt;B&gt;Product.ProductID&lt;/B&gt;, StandardCostFROM SalesOrderDetail, Product;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Aug 2010 09:18:06 GMT</pubDate>
    <dc:creator>Miguel_Angel_Baeyens</dc:creator>
    <dc:date>2010-08-05T09:18:06Z</dc:date>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241484#M91898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create an expression called Sales by using the following fields:&lt;/P&gt;&lt;P&gt;Quantity&lt;/P&gt;&lt;P&gt;Price&lt;/P&gt;&lt;P&gt;Discount&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already know i need to take Quantity and multiply it by the price and minus the discount. I can do that manually in expressions but i need to create a set expression and it may not be done by using a variable. Can anyone help me create it in the script or something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please, any ideas are welcome&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 09:20:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241484#M91898</guid>
      <dc:creator />
      <dc:date>2010-08-04T09:20:29Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241485#M91899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;why you can't do it in load script? for example such as:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;Quantity * Price * (1-Discount) AS Sales&lt;/P&gt;&lt;P&gt;FROM...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 10:27:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241485#M91899</guid>
      <dc:creator>sparur</dc:creator>
      <dc:date>2010-08-04T10:27:29Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241486#M91900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yea i figured it out...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD OrderQty,&lt;/P&gt;&lt;P&gt;ProductID,&lt;/P&gt;&lt;P&gt;UnitPrice,&lt;/P&gt;&lt;P&gt;UnitPriceDiscount,&lt;/P&gt;&lt;P&gt;num((OrderQty*UnitPrice)-UnitPriceDiscount) as Sales;&lt;/P&gt;&lt;P&gt;SQL SELECT OrderQty,&lt;/P&gt;&lt;P&gt;ProductID,&lt;/P&gt;&lt;P&gt;UnitPrice,&lt;/P&gt;&lt;P&gt;UnitPriceDiscount&lt;/P&gt;&lt;P&gt;FROM SalesOrderDetail;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 10:57:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241486#M91900</guid>
      <dc:creator />
      <dc:date>2010-08-04T10:57:49Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241487#M91901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When i try to do the same to work out cost, the script keeps loading lines that are way more than there are already... i used&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD StandardCost,&lt;/P&gt;&lt;P&gt;OrderQty,&lt;/P&gt;&lt;P&gt;num(StandardCost*OrderQty) as Cost;&lt;/P&gt;&lt;P&gt;SQL SELECT OrderQty,&lt;/P&gt;&lt;P&gt;StandardCost&lt;/P&gt;&lt;P&gt;FROM SalesOrderDetail,&lt;/P&gt;&lt;P&gt;Product;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;for cost but it loads more than 15million lines and before i put in the formula it only loads 30 000 lines...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 11:01:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241487#M91901</guid>
      <dc:creator />
      <dc:date>2010-08-04T11:01:35Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241488#M91902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Add ProductID in Load &amp;amp; SQL Select sentence, this explain diff in quantity records&lt;/P&gt;&lt;P&gt;/Luis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 12:12:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241488#M91902</guid>
      <dc:creator>llauses243</dc:creator>
      <dc:date>2010-08-04T12:12:27Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241489#M91903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No comprenday&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 14:37:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241489#M91903</guid>
      <dc:creator />
      <dc:date>2010-08-04T14:37:47Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241490#M91904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;He's saying, you'll need to load in the ProductID in the table where you calculate cost, ie:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;ProductID,&lt;/P&gt;&lt;P&gt;StandardCost,&lt;/P&gt;&lt;P&gt;OrderQty,&lt;/P&gt;&lt;P&gt;num(StandardCost*OrderQty) as Cost;&lt;/P&gt;&lt;P&gt;SQL SELECT OrderQty,&lt;/P&gt;&lt;P&gt;ProductID,&lt;/P&gt;&lt;P&gt;StandardCost&lt;/P&gt;&lt;P&gt;FROM SalesOrderDetail,&lt;/P&gt;&lt;P&gt;Product;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the moment, you are working out 'Sales' for every product, and then for each of these rows, you are working out every 'Cost' for every row. (Cartesian set). How does it know which Cost goes with which Sales amount? It doesn't, so it puts all of them with all of them. (Hence so many rows!) By adding the ProductID to both, it knows which Cost goes with which Sales and puts them on the same row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, you could work out the Sales in the same load statement, which would achieve the same result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 15:03:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241490#M91904</guid>
      <dc:creator>richnorris</dc:creator>
      <dc:date>2010-08-04T15:03:21Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241491#M91905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys.&lt;/P&gt;&lt;P&gt;Once again thanks so much for all the responses i really appreciate it. I tried the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;ProductID,&lt;/P&gt;&lt;P&gt;StandardCost,&lt;/P&gt;&lt;P&gt;OrderQty,&lt;/P&gt;&lt;P&gt;num(StandardCost*OrderQty) as Cost;&lt;/P&gt;&lt;P&gt;SQL SELECT OrderQty,&lt;/P&gt;&lt;P&gt;ProductID,&lt;/P&gt;&lt;P&gt;StandardCost&lt;/P&gt;&lt;P&gt;FROM SalesOrderDetail,&lt;/P&gt;&lt;P&gt;Product;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it came up with this:&lt;/P&gt;&lt;P&gt;&lt;A href="http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/5468.Script-Error.jpg"&gt;&lt;IMG alt="" border="0" src="http://community.qlik.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Discussions.Components.Files/11/5468.Script-Error.jpg" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Any Ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks alot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Aug 2010 07:31:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241491#M91905</guid>
      <dc:creator />
      <dc:date>2010-08-05T07:31:56Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241492#M91906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no update?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Aug 2010 08:58:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241492#M91906</guid>
      <dc:creator />
      <dc:date>2010-08-05T08:58:38Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241493#M91907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;It's just an SQL writing issue, as ProductID field is present in both Product and SalesOrderDetail tables in your database, and you must specify in your SQL statement which of both you want to get&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;LOAD ProductID, StandardCost, OrderQty, num(StandardCost*OrderQty) as Cost;SQL SELECT OrderQty, &lt;B&gt;Product.ProductID&lt;/B&gt;, StandardCostFROM SalesOrderDetail, Product;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Aug 2010 09:18:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241493#M91907</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-08-05T09:18:06Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241494#M91908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;im sorry but i dnt understand???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Aug 2010 09:42:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241494#M91908</guid>
      <dc:creator />
      <dc:date>2010-08-05T09:42:32Z</dc:date>
    </item>
    <item>
      <title>Create an Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241495#M91909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Blaze,&lt;/P&gt;&lt;P&gt;Your "ProductID" field exists in the two tables you are loading, "SalesOrderDetail" and "Product". The error ODBC is throwing and you posted above means that when you do the SQL query, and one fieldname exists in more than one table, you must specify the name of the table from where you want to get that field.&lt;/P&gt;&lt;P&gt;Take into account that the ODBC passes the same statement you have written, so if it has errors, the query won't be executed. I guess that you will get the same error if you perform the same query in your SQL console.&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Aug 2010 09:50:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-an-Expression/m-p/241495#M91909</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-08-05T09:50:20Z</dc:date>
    </item>
  </channel>
</rss>

