<?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 converting nested if statement into a set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553693#M206869</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;&lt;/P&gt;&lt;P&gt;I need to create a set analysis which includes nested if statements. It's about the material price for the previous year, based on currency. It should be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;YEAR_CODE = {$(vPY)}&amp;gt;} $(vActPrice)) &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;where vPY = max(YEAR_CODE)-1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;and &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;vActPrice = sum(if(CURRENCY = 'LOCAL', LOCAL_PRICE, IF(CURRENCY = 'USD', USD_PRICE, EUR_PRICE)))/ sum(QUANTITY)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I translate this formula?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;&lt;P&gt;Cristina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Sep 2013 09:49:09 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-09-23T09:49:09Z</dc:date>
    <item>
      <title>converting nested if statement into a set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553693#M206869</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;&lt;/P&gt;&lt;P&gt;I need to create a set analysis which includes nested if statements. It's about the material price for the previous year, based on currency. It should be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;YEAR_CODE = {$(vPY)}&amp;gt;} $(vActPrice)) &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;where vPY = max(YEAR_CODE)-1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;and &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;vActPrice = sum(if(CURRENCY = 'LOCAL', LOCAL_PRICE, IF(CURRENCY = 'USD', USD_PRICE, EUR_PRICE)))/ sum(QUANTITY)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I translate this formula?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;&lt;P&gt;Cristina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 09:49:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553693#M206869</guid>
      <dc:creator />
      <dc:date>2013-09-23T09:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: converting nested if statement into a set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553694#M206870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=Sum({&amp;lt;YEAR_CODE = {$(vPY)},CURRENCY = {$(vCURRENCY)} &amp;gt;} $(vActPrice))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set up a variable vCURRENCY to be the currency variable&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 10:28:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553694#M206870</guid>
      <dc:creator />
      <dc:date>2013-09-23T10:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: converting nested if statement into a set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553695#M206871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be like this?&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;CURRENCY={'LOCAL'}&amp;gt;}LOCAL_PRICE) +&lt;/P&gt;&lt;P&gt; Sum({&amp;lt;CURRENCY={'USD'}&amp;gt;}USD_PRICE)+&lt;/P&gt;&lt;P&gt; Sum({&amp;lt;CURRENCY ={*} - {'LOCAL','USD'}&amp;gt;}EUR_PRICE)&lt;/P&gt;&lt;P&gt;) / Sum(QUANTITY)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 10:44:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553695#M206871</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2013-09-23T10:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: converting nested if statement into a set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553696#M206872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not so sure whether I understood your solution. How should I set up vCurrency? We should consider that ActPrice points to many indicators on the basis of the currency value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 12:04:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553696#M206872</guid>
      <dc:creator />
      <dc:date>2013-09-23T12:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: converting nested if statement into a set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553697#M206873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Thanks for your reply, but using this formula I get different values from what I'm expecting. Moreover, I need to take into consideration the fact that I have another condition too (previous year) and I don't know how to put it together.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 13:40:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553697#M206873</guid>
      <dc:creator />
      <dc:date>2013-09-23T13:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: converting nested if statement into a set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553698#M206874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, missed that. Try like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum({&amp;lt;YEAR_CODE={"$(=(Max(YEAR_CODE)-1))"}, CURRENCY={'LOCAL'}&amp;gt;}LOCAL_PRICE) +&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum({&amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;YEAR_CODE={"$(=(Max(YEAR_CODE)-1))"},&lt;/SPAN&gt; CURRENCY={'USD'}&amp;gt;}USD_PRICE)+&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum({&amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;YEAR_CODE={"$(=(Max(YEAR_CODE)-1))"},&lt;/SPAN&gt; CURRENCY ={*} - {'LOCAL','USD'}&amp;gt;}EUR_PRICE)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;) / Sum({&amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;YEAR_CODE={"$(=(Max(YEAR_CODE)-1))"&amp;gt;}&lt;/SPAN&gt;QUANTITY)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 15:53:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/converting-nested-if-statement-into-a-set-analysis/m-p/553698#M206874</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2013-09-23T15:53:32Z</dc:date>
    </item>
  </channel>
</rss>

