<?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 Set Expression with different modifiers for the same field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180752#M887067</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my data contains sales to different Customer Groups (field name is 'Status'). The two classes are Third Paties and Intercompany. To calculate the consolidated Gross Margin in % I have to divide the total Gross Margin (Sales - Purchases to all Customers) by the Sales to Third Parties.&lt;/P&gt;&lt;P&gt;In made up a Alternate Status ("aktJahr") and the Data selction is set to "Third Parties".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression works fine and gives a correct result&lt;/P&gt;&lt;P&gt;=sum({aktJahr&amp;lt; Status = &amp;gt;} (Sales-Purchases))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I try to divide by&lt;/P&gt;&lt;P&gt;sum(Sales)&amp;nbsp; &lt;/P&gt;&lt;P&gt;the Result is wrong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this:&lt;/P&gt;&lt;P&gt;=sum({aktJahr&amp;lt; Status = &amp;gt;} (Sales-Purchases)) / sum({aktJahr&amp;lt; Status = { 'Third Parties' }&amp;gt;} VK_Wert )&lt;/P&gt;&lt;P&gt;but it produces the same mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does someone have an idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Set Expression with different modifiers for the same field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180752#M887067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my data contains sales to different Customer Groups (field name is 'Status'). The two classes are Third Paties and Intercompany. To calculate the consolidated Gross Margin in % I have to divide the total Gross Margin (Sales - Purchases to all Customers) by the Sales to Third Parties.&lt;/P&gt;&lt;P&gt;In made up a Alternate Status ("aktJahr") and the Data selction is set to "Third Parties".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression works fine and gives a correct result&lt;/P&gt;&lt;P&gt;=sum({aktJahr&amp;lt; Status = &amp;gt;} (Sales-Purchases))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I try to divide by&lt;/P&gt;&lt;P&gt;sum(Sales)&amp;nbsp; &lt;/P&gt;&lt;P&gt;the Result is wrong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this:&lt;/P&gt;&lt;P&gt;=sum({aktJahr&amp;lt; Status = &amp;gt;} (Sales-Purchases)) / sum({aktJahr&amp;lt; Status = { 'Third Parties' }&amp;gt;} VK_Wert )&lt;/P&gt;&lt;P&gt;but it produces the same mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does someone have an idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180752#M887067</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression with different modifiers for the same field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180753#M887068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I made a small mistake. To avoid misunderstanding the last expression should read:&lt;/P&gt;&lt;P&gt;=sum({aktJahr&amp;lt; Status = &amp;gt;} (Sales-Purchases)) / sum({aktJahr&amp;lt; Status = { 'Third Parties' }&amp;gt;} Sales )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Sep 2016 09:35:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180753#M887068</guid>
      <dc:creator />
      <dc:date>2016-09-12T09:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression with different modifiers for the same field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180754#M887069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried looking at just Sum(Sales) expression to check if that is giving the right number or not? I would say that provide us with a sample and expected output and one of us will def. try to help you out here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Sep 2016 16:08:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180754#M887069</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-09-12T16:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression with different modifiers for the same field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180755#M887070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanx for your reply.&lt;/P&gt;&lt;P&gt;Yes, I checked it and it gives me the correct result. In fact both versions the simple sum(sales) as well as the set analysis expression work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While working on another problem (comparison YTD vs previous YTD) I found the solution:&lt;/P&gt;&lt;P&gt;=num(sum({aktJahr&amp;lt; Year={'$(vPriorYear)'},Date={'&amp;lt;=$(vPriorYearDate)'},Status = &amp;gt;} (Sales - Purchase))/SUM({&amp;lt;Year={'$(vPriorYear)'},Date={'&amp;lt;=$(vPriorYearDate)'}&amp;gt;} Sales) , '0,0%')&lt;/P&gt;&lt;P&gt;I got input searching for a solution in the Resource library (&lt;A _jive_internal="true" data-containerid="2049" data-containertype="14" data-objectid="4313" data-objecttype="102" href="https://community.qlik.com/docs/DOC-4313"&gt;http://community.qlik.com/docs/DOC-4313&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Certainly I will need the help from the community in the future......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Stephan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 08:44:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180755#M887070</guid>
      <dc:creator />
      <dc:date>2016-09-13T08:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression with different modifiers for the same field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180756#M887071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome, I am glad you were able to get your problem resolved &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;. Mark you response as correct to close this thread down.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Sep 2016 01:21:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-with-different-modifiers-for-the-same-field/m-p/1180756#M887071</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-09-14T01:21:54Z</dc:date>
    </item>
  </channel>
</rss>

