<?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 Re: IF AND OR statement in set analysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1698022#M53423</link>
    <description>&lt;P&gt;I finally managed to figure it out! The problem with the previous one was that instead of having EAV as Else I just needed to replace it with a 1 because it was preceded with / it divides it with the Else statement so replacing it with the 1 means you get the original EAV calculation. Thank you so much for your help Lauri I couldn't have solved it without it. Here is the correct calculation:&lt;/P&gt;&lt;P&gt;(SUM( AGGR(AVG(EAV), ArticleKey))/7.45) /&lt;/P&gt;&lt;P&gt;If([MediaTypeName]= '**bleep**blade og magasiner'AND [MediaCountryName] = 'Danmark' ,7*([Størrelse]),&lt;/P&gt;&lt;P&gt;If([MediaTypeName] = '**bleep**blade og magasiner' AND Match([MediaCountryName], 'Sverige', 'Norge'), 2*([Størrelse]), 1))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Apr 2020 08:42:19 GMT</pubDate>
    <dc:creator>julian</dc:creator>
    <dc:date>2020-04-30T08:42:19Z</dc:date>
    <item>
      <title>IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697056#M53317</link>
      <description>&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;If have this calculation&amp;nbsp;&lt;/P&gt;&lt;P&gt;(SUM( AGGR(AVG(EAV), ArticleKey)) / 7.45)&lt;/P&gt;&lt;P&gt;I need to add the following. If [MediaName ]= 'Magazine' AND MediaCountry = 'Denmark' /7 *[ArticleSize] OR&amp;nbsp;[MediaName] = '**bleep**blade &amp;amp; Magasiner'&amp;nbsp;AND [MediaCountry] = Sweden OR Norway /2 *[ArticleSize]&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 21:08:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697056#M53317</guid>
      <dc:creator>julian</dc:creator>
      <dc:date>2021-12-20T21:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697096#M53320</link>
      <description>&lt;P&gt;Do you mean you need to change the divisor from 7.45 to something else depending on the IF statement?&amp;nbsp; You can put an IF statement in like this:&lt;/P&gt;&lt;P&gt;(SUM( AGGR(AVG(EAV), ArticleKey)) /&lt;/P&gt;&lt;P&gt;If([MediaName]= 'Magazine' AND MediaCountry = 'Denmark', 7*[ArticleSize],&lt;/P&gt;&lt;P&gt;If([MediaName] = '**bleep**blade &amp;amp; Magasiner'&amp;nbsp;AND Match([MediaCountry], 'Sweden', 'Norway'), 2*[ArticleSize])&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;However, if ArticleSize is at the same detail level as ArticleKey, you won't get logical results (or maybe any results) because you are dividing an aggregate SUM by a more detail level number. So you would need to also aggregate your divisor, perhaps with the same SUM(AGGR(AVG())), which would look like:&lt;/P&gt;&lt;P&gt;(SUM( AGGR(AVG(EAV), ArticleKey)) /&lt;/P&gt;&lt;P&gt;SUM( AGGR(AVG(If([MediaName]= 'Magazine' AND MediaCountry = 'Denmark', 7*[ArticleSize],&lt;/P&gt;&lt;P&gt;If([MediaName] = '**bleep**blade &amp;amp; Magasiner'&amp;nbsp;AND Match([MediaCountry], 'Sweden', 'Norway'), 2*[ArticleSize])), ArticleKey))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2020 14:16:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697096#M53320</guid>
      <dc:creator>Lauri</dc:creator>
      <dc:date>2020-04-27T14:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697319#M53341</link>
      <description>&lt;P&gt;Hi Lauri&lt;/P&gt;&lt;P&gt;Thank you for your suggestion. I still need the 7.45 divisor as this is used to get the price in euros. Using what you suggested the following:&lt;/P&gt;&lt;P&gt;SUM( AGGR(AVG(EAV), ArticleKey))/7.45 /&lt;/P&gt;&lt;P&gt;If([&lt;SPAN&gt;MediaName&lt;/SPAN&gt;]= '&lt;SPAN&gt;Magazine&lt;/SPAN&gt;'AND MediaCountry = 'Denmark' ,7*([&lt;SPAN&gt;ArticleSize&lt;/SPAN&gt;]),&lt;/P&gt;&lt;P&gt;If([&lt;SPAN&gt;MediaName&lt;/SPAN&gt;] = '**bleep**blade og magasiner' AND Match([MediaCountry], '&lt;SPAN&gt;Sweden&lt;/SPAN&gt;', '&lt;SPAN&gt;Norway&lt;/SPAN&gt;'), 2*([&lt;SPAN&gt;ArticleSize&lt;/SPAN&gt;])))&lt;/P&gt;&lt;P&gt;works but only for Sweden and Norway. For Denmark it is for reason off by a factor 4. Also when using this I only get results for these categories and none of the other where it should show the 'regular' EAV.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 08:56:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697319#M53341</guid>
      <dc:creator>julian</dc:creator>
      <dc:date>2020-04-28T08:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697327#M53344</link>
      <description>&lt;P&gt;maybe this:&lt;BR /&gt;&lt;BR /&gt;=SUM( AGGR( AVG(&lt;BR /&gt;If( [MediaName] = 'Magazine' AND MediaCountry = 'Denmark', EAV * [ArticleSize] / 7,&lt;BR /&gt;if( [MediaName] = '**bleep**blade &amp;amp; Magasiner' AND ( [MediaCountry] = 'Sweden' OR [MediaCountry] = 'Norway' ), EAV * [ArticleSize] / 2 ), EAV&lt;BR /&gt;) )&lt;BR /&gt;, ArticleKey ) )&lt;BR /&gt;/&lt;BR /&gt;7.45&lt;/P&gt;&lt;P&gt;I hope it can helps.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 09:31:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697327#M53344</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2020-04-28T09:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697341#M53348</link>
      <description>&lt;P&gt;Unfortunately, that just returns a zero&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 10:10:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697341#M53348</guid>
      <dc:creator>julian</dc:creator>
      <dc:date>2020-04-28T10:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697350#M53351</link>
      <description>&lt;P&gt;Let's add &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;parentheses&lt;/STRONG&gt; &lt;/FONT&gt;to make sure the calculations are in the correct order, and also the &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;else&lt;/STRONG&gt;&lt;/FONT&gt; condition:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;/FONT&gt;SUM( AGGR(AVG(EAV), ArticleKey))/7.45 &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt; &lt;/STRONG&gt;/&lt;/P&gt;&lt;P&gt;If([&lt;SPAN&gt;MediaName&lt;/SPAN&gt;]= '&lt;SPAN&gt;Magazine&lt;/SPAN&gt;' AND MediaCountry = 'Denmark' ,7*([&lt;SPAN&gt;ArticleSize&lt;/SPAN&gt;]),&lt;/P&gt;&lt;P&gt;If([&lt;SPAN&gt;MediaName&lt;/SPAN&gt;] = '**bleep**blade og magasiner' AND Match([MediaCountry], '&lt;SPAN&gt;Sweden&lt;/SPAN&gt;', '&lt;SPAN&gt;Norway&lt;/SPAN&gt;'), 2*([&lt;SPAN&gt;ArticleSize&lt;/SPAN&gt;])&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;, EAV&lt;/STRONG&gt;&lt;/FONT&gt;))&lt;/P&gt;&lt;P&gt;I am guessing that EAV is the right thing to put in as the 'regular' EAV.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:03:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697350#M53351</guid>
      <dc:creator>Lauri</dc:creator>
      <dc:date>2020-04-28T11:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697363#M53354</link>
      <description>&lt;P&gt;That just returns 0.1342... for all articles&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:29:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697363#M53354</guid>
      <dc:creator>julian</dc:creator>
      <dc:date>2020-04-28T11:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697370#M53356</link>
      <description>&lt;P&gt;Is 0.1342 what you get if you calculate&amp;nbsp;&lt;FONT color="#333333"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;SUM( AGGR(AVG(EAV), ArticleKey))/7.45&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;) / &lt;/STRONG&gt;EAV? This would tell us that something is wrong with the entire IF statement, and it's always going to the last Else statement (which contains just EAV).&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:44:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697370#M53356</guid>
      <dc:creator>Lauri</dc:creator>
      <dc:date>2020-04-28T11:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697377#M53359</link>
      <description>&lt;P&gt;Just checked and yes that is&amp;nbsp; what is happening&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:53:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697377#M53359</guid>
      <dc:creator>julian</dc:creator>
      <dc:date>2020-04-28T11:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697806#M53403</link>
      <description>&lt;P&gt;Have you figured out what is wrong with the If statements? They look ok to me, but I don't know your details well enough to be sure. The other possibility is what I initially said: You need to aggregate the result of your If statement.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 15:11:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1697806#M53403</guid>
      <dc:creator>Lauri</dc:creator>
      <dc:date>2020-04-29T15:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND OR statement in set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1698022#M53423</link>
      <description>&lt;P&gt;I finally managed to figure it out! The problem with the previous one was that instead of having EAV as Else I just needed to replace it with a 1 because it was preceded with / it divides it with the Else statement so replacing it with the 1 means you get the original EAV calculation. Thank you so much for your help Lauri I couldn't have solved it without it. Here is the correct calculation:&lt;/P&gt;&lt;P&gt;(SUM( AGGR(AVG(EAV), ArticleKey))/7.45) /&lt;/P&gt;&lt;P&gt;If([MediaTypeName]= '**bleep**blade og magasiner'AND [MediaCountryName] = 'Danmark' ,7*([Størrelse]),&lt;/P&gt;&lt;P&gt;If([MediaTypeName] = '**bleep**blade og magasiner' AND Match([MediaCountryName], 'Sverige', 'Norge'), 2*([Størrelse]), 1))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 08:42:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-AND-OR-statement-in-set-analysis/m-p/1698022#M53423</guid>
      <dc:creator>julian</dc:creator>
      <dc:date>2020-04-30T08:42:19Z</dc:date>
    </item>
  </channel>
</rss>

