<?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 Complex If Logic in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172670#M42148</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wes&lt;/P&gt;&lt;P&gt;Thanks I did not think about this. An inline table or Excel sheet. This would 'assign' the correct margins to the correct accounts.&lt;/P&gt;&lt;P&gt;I will post a solution once I develop one.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Aug 2010 14:52:22 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-08-25T14:52:22Z</dc:date>
    <item>
      <title>Complex If Logic</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172668#M42146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I attempting to create a complex if statement to handle 'Split Accounts.' Accounts where a margin % goes to one party and another % goes to another party. I have created logic to do this independent but combining them has provided to be a hurdle. Any assistance would be much appreciated. This statement will be an expression in a pivot table. See below for details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement sums Margin cost for all orders. Then takes certain 'split' accounts and divides the margin in half. This worked fine until our commission rules changed for a split account.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;&lt;BR /&gt;=(sum(extended_price-(commission_cost*qty_shipped)))-(sum(IF(match(salesrep_id,&lt;BR /&gt;3208,3219,3293,3212, 3364,3295),&lt;BR /&gt;(extended_price-(commission_cost*qty_shipped))/2)))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This statement assigns a 20% margin to salesrep_id 1024. KenSpilt20 is a local variable taking the margin amount from the split account.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;=if(salesrep_id=1024, sum((extended_price-(commission_cost*qty_shipped)))+kenSpilt20)&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Similar to the last statement this one assigns 80% to salesrep_id 1023. KenSpilt80 is a local variable taking the margin amount from the split account.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;=if(salesrep_id=1023, sum((extended_price-(commission_cost*qty_shipped)))+kenSpilt80)&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Each statement works individually. My goal is to combine the 2 last statements into the first statement. Something similar to this... This equation does not work because multiple if logic exists. I am unsure of how to create a if statement combining all the logic together.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;&lt;BR /&gt;=(sum(extended_price-(commission_cost*qty_shipped)))-(sum(IF(match(salesrep_id,&lt;BR /&gt;3208,3219,3293,3212, 3364,3295),&lt;BR /&gt;(extended_price-(commission_cost*qty_shipped))/2)))&lt;BR /&gt;+(if(salesrep_id=1024, sum((extended_price-(commission_cost*qty_shipped)))+kenSpilt20))&lt;BR /&gt;+ (if(salesrep_id=1023, sum((extended_price-(commission_cost*qty_shipped)))+kenSpilt80))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help or a different approach to this.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Aug 2010 16:34:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172668#M42146</guid>
      <dc:creator />
      <dc:date>2010-08-24T16:34:25Z</dc:date>
    </item>
    <item>
      <title>Complex If Logic</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172669#M42147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do the conditions in the "if" statement need to be in the front-end for users to modify? If not, what if you used an Excel file as a data source with the appropriate split rates for each sales rep ID?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your excel file would be something like this:&lt;/P&gt;&lt;P&gt;Sales Rep ID | Commission Rate&lt;BR /&gt;12345 | 0.20 |&lt;BR /&gt;67890 | 1.00 |&lt;/P&gt;&lt;P&gt;Then your formula in the expression could simply multiply by commission rate, without an IF statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Aug 2010 21:23:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172669#M42147</guid>
      <dc:creator />
      <dc:date>2010-08-24T21:23:56Z</dc:date>
    </item>
    <item>
      <title>Complex If Logic</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172670#M42148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wes&lt;/P&gt;&lt;P&gt;Thanks I did not think about this. An inline table or Excel sheet. This would 'assign' the correct margins to the correct accounts.&lt;/P&gt;&lt;P&gt;I will post a solution once I develop one.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 14:52:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172670#M42148</guid>
      <dc:creator />
      <dc:date>2010-08-25T14:52:22Z</dc:date>
    </item>
    <item>
      <title>Complex If Logic</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172671#M42149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Creating an inline table as a placeholder worked. Your above example worked.&lt;/P&gt;&lt;P&gt;Then I used the same local variable as mentioned above. Then added to the total Margin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;&lt;BR /&gt;=(sum(extended_price-(commission_cost*qty_shipped)))-(sum(IF(match(salesrep_id, 3209...,),&lt;BR /&gt;(extended_price-(commission_cost*qty_shipped))/2)))+sum(kenSpiltMargin*commission)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Now I need to figure out how not to add the total for the split account... but this is a separate issue....&lt;/P&gt;&lt;P&gt;Thanks for your help Wes.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 16:41:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172671#M42149</guid>
      <dc:creator />
      <dc:date>2010-08-25T16:41:23Z</dc:date>
    </item>
    <item>
      <title>Complex If Logic</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172672#M42150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just as a side note I find Stefan WALTHER nested If Generator a big help when trying to create complex IF statements,&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.qlikblog.at/tools/Nested-If-Generator.html"&gt;http://www.qlikblog.at/tools/Nested-If-Generator.html&lt;/A&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;Mind you could be that I am just lazy !!&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;Gav.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 16:51:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-If-Logic/m-p/172672#M42150</guid>
      <dc:creator />
      <dc:date>2010-08-25T16:51:21Z</dc:date>
    </item>
  </channel>
</rss>

