<?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 Divide two variables in an expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Divide-two-variables-in-an-expression/m-p/994632#M338604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;Hello, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;Can anyone help me with the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;In the script, I have declared two variables for a dashboard view:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: blue; font-size: 10.0pt; font-family: 'Courier New';"&gt;let&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;vSalesCY&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;='Sum ({1&amp;lt;Sales_Cust_Class_Code-={100},D_Date.Cal_Yr={$(vFY_0)}&amp;gt;}Restate_USD_Net_Sales_Amt_Ext)/1000';&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 10.0pt; font-family: 'Courier New';"&gt;let&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;vSalesLY&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;='Sum ({1&amp;lt;Sales_Cust_Class_Code-={100},D_Date.Cal_Yr={$(vFY_1)}&amp;gt;}Restate_USD_Net_Sales_Amt_Ext)/1000';&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;I use them in a chart (table) which works fine as =&lt;EM&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt;"&gt;(vSalesCY)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;I want to add the difference in a 3&lt;SUP&gt;rd&lt;/SUP&gt; column by dividing the two:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;=&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;S(vSalesCY) / S(vSalesLY&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;(I can add, substract, multiply the two variables, but not divide...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;It gives me an incorrect result; can I not so something like this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;(&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;I did also try&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt; =$((S(vSalesCY) / S(vSalesLY))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: gray; font-size: 10.0pt; font-family: arial, helvetica, sans-serif;"&gt;Thanks Hans&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Sep 2015 16:14:37 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-09-21T16:14:37Z</dc:date>
    <item>
      <title>Divide two variables in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Divide-two-variables-in-an-expression/m-p/994632#M338604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;Hello, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;Can anyone help me with the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;In the script, I have declared two variables for a dashboard view:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: blue; font-size: 10.0pt; font-family: 'Courier New';"&gt;let&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;vSalesCY&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;='Sum ({1&amp;lt;Sales_Cust_Class_Code-={100},D_Date.Cal_Yr={$(vFY_0)}&amp;gt;}Restate_USD_Net_Sales_Amt_Ext)/1000';&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 10.0pt; font-family: 'Courier New';"&gt;let&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;vSalesLY&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;='Sum ({1&amp;lt;Sales_Cust_Class_Code-={100},D_Date.Cal_Yr={$(vFY_1)}&amp;gt;}Restate_USD_Net_Sales_Amt_Ext)/1000';&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;I use them in a chart (table) which works fine as =&lt;EM&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt;"&gt;(vSalesCY)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;I want to add the difference in a 3&lt;SUP&gt;rd&lt;/SUP&gt; column by dividing the two:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;=&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;S(vSalesCY) / S(vSalesLY&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;(I can add, substract, multiply the two variables, but not divide...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;It gives me an incorrect result; can I not so something like this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;(&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;I did also try&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt; =$((S(vSalesCY) / S(vSalesLY))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: gray; font-size: 10.0pt; font-family: arial, helvetica, sans-serif;"&gt;Thanks Hans&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2015 16:14:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Divide-two-variables-in-an-expression/m-p/994632#M338604</guid>
      <dc:creator />
      <dc:date>2015-09-21T16:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Divide two variables in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Divide-two-variables-in-an-expression/m-p/994633#M338605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is caused by the division that happens within the calculations stored in variables. When the two formulas are divided by each other, the division signs get mixed up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The easiest and the most universal solution is to enclose your initial formulas within the variables in another pair of parentheses:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;let&lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; &lt;/SPAN&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-size: 10pt; font-family: 'Courier New'; color: gray;"&gt;vSalesCY&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;='&lt;STRONG&gt;(&lt;/STRONG&gt;Sum ({1&amp;lt;Sales_Cust_Class_Code-={100},D_Date.Cal_Yr={$(vFY_0)}&amp;gt;}Restate_USD_Net_Sales_Amt_Ext)/1000&lt;STRONG&gt;)&lt;/STRONG&gt;';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this way, the formula will always work, no matter what other operations are used on top.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.amazon.com/gp/product/1118949552/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1118949552&amp;amp;linkCode=as2&amp;amp;tag=natursyner0f-20&amp;amp;linkId=HEF4KYLLE22XIQH2"&gt;QlikView Your Business: An expert guide to Business Discovery with QlikView and Qlik Sense&lt;/A&gt;&lt;IMG alt="" border="0" height="1" src="http://ir-na.amazon-adsystem.com/e/ir?t=natursyner0f-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=1118949552" style="border: none !important; margin: 0px !important;" width="1" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2015 22:48:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Divide-two-variables-in-an-expression/m-p/994633#M338605</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2015-09-21T22:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Divide two variables in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Divide-two-variables-in-an-expression/m-p/994634#M338606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes!&lt;/P&gt;&lt;P&gt;it works fine, Oleg &lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Hans&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2015 11:24:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Divide-two-variables-in-an-expression/m-p/994634#M338606</guid>
      <dc:creator />
      <dc:date>2015-09-22T11:24:24Z</dc:date>
    </item>
  </channel>
</rss>

