<?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 Using Set Modifiers based on another field {$&amp;lt;FieldA = FieldB&amp;gt;} in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-Set-Modifiers-based-on-another-field-lt-FieldA-FieldB-gt/m-p/1661007#M49611</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the Qlik help there is a statement that you can use a set modifier expression based on another field, like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum({$&amp;lt;OrderDate = DeliveryDate&amp;gt;} Sales)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysis/set-analysis-expressions.htm" target="_self"&gt;https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysis/set-analysis-expressions.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, I constructed an example (QVF attached), that I want to do exactly that and it does not work:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set Expression:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=sum({1&amp;lt;OrderDate=DeliveryDate&amp;gt;}SentAmount)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fruits:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;Fruit, State, SentAmount, SupplierID, BackAmount, OrderDate, DeliveryDate&lt;BR /&gt;Apple, Foul, 2, 1, 2, 201901, 201901&lt;BR /&gt;Apple, Good, 8, 2, 0, 201902, 201902&lt;BR /&gt;Pear, Foul, 5, 3, 5, 201903, 201903,&lt;BR /&gt;Pear, Good, 7, 3, 2, 201901, 201901,&lt;BR /&gt;Banana, Foul, 4, 4, 2, 201902, 201903&lt;BR /&gt;Banana, Good, 5, 5, 0, 201904, 201906&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course I can use an if statement, in which case I get the desired result:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=sum(if(OrderDate=DeliveryDate,SentAmount))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But if Qlik help page states that&amp;nbsp;&lt;STRONG&gt;sum({$&amp;lt;OrderDate = DeliveryDate&amp;gt;} Sales)&amp;nbsp;&lt;/STRONG&gt;is possible, why does it not work?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which option is better in terms of performance with big data sets?&lt;/P&gt;&lt;P&gt;Kind Regards and thanks a lot,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eddy&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 19:22:54 GMT</pubDate>
    <dc:creator>Eddy</dc:creator>
    <dc:date>2024-11-16T19:22:54Z</dc:date>
    <item>
      <title>Using Set Modifiers based on another field {$&lt;FieldA = FieldB&gt;}</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Set-Modifiers-based-on-another-field-lt-FieldA-FieldB-gt/m-p/1661007#M49611</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the Qlik help there is a statement that you can use a set modifier expression based on another field, like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum({$&amp;lt;OrderDate = DeliveryDate&amp;gt;} Sales)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysis/set-analysis-expressions.htm" target="_self"&gt;https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysis/set-analysis-expressions.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, I constructed an example (QVF attached), that I want to do exactly that and it does not work:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set Expression:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=sum({1&amp;lt;OrderDate=DeliveryDate&amp;gt;}SentAmount)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fruits:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;Fruit, State, SentAmount, SupplierID, BackAmount, OrderDate, DeliveryDate&lt;BR /&gt;Apple, Foul, 2, 1, 2, 201901, 201901&lt;BR /&gt;Apple, Good, 8, 2, 0, 201902, 201902&lt;BR /&gt;Pear, Foul, 5, 3, 5, 201903, 201903,&lt;BR /&gt;Pear, Good, 7, 3, 2, 201901, 201901,&lt;BR /&gt;Banana, Foul, 4, 4, 2, 201902, 201903&lt;BR /&gt;Banana, Good, 5, 5, 0, 201904, 201906&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course I can use an if statement, in which case I get the desired result:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=sum(if(OrderDate=DeliveryDate,SentAmount))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But if Qlik help page states that&amp;nbsp;&lt;STRONG&gt;sum({$&amp;lt;OrderDate = DeliveryDate&amp;gt;} Sales)&amp;nbsp;&lt;/STRONG&gt;is possible, why does it not work?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which option is better in terms of performance with big data sets?&lt;/P&gt;&lt;P&gt;Kind Regards and thanks a lot,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eddy&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:22:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Set-Modifiers-based-on-another-field-lt-FieldA-FieldB-gt/m-p/1661007#M49611</guid>
      <dc:creator>Eddy</dc:creator>
      <dc:date>2024-11-16T19:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Modifiers based on another field {$&lt;FieldA = FieldB&gt;}</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Set-Modifiers-based-on-another-field-lt-FieldA-FieldB-gt/m-p/1661047#M49620</link>
      <description>&lt;P&gt;For these type of comparisons the best option (and fastest) is to create an extra flag during&amp;nbsp; load; you compare the two fields and then make your selections based on the new flag&lt;/P&gt;&lt;P&gt;The if statement is the second best option as it works on a row by row level of your data&lt;/P&gt;&lt;P&gt;The set expression is the least favourable option because it is evaluated once per chart and it's not (I believe) designed to make row by row comparisons; if you want to make it work you need to use something like this where you define two sets and you join them together (I'm not 100% sure myself why this works but it might be due to how data is grouped when the set analysis is perfomed):&lt;/P&gt;&lt;P&gt;{1 &amp;lt;OrderDate={"=DeliveryDate=OrderDate"}&amp;gt; + 1&amp;lt;DeliveryDate={"=OrderDate=DeliveryDate"}&amp;gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2019 15:25:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Set-Modifiers-based-on-another-field-lt-FieldA-FieldB-gt/m-p/1661047#M49620</guid>
      <dc:creator>lorenzoconforti</dc:creator>
      <dc:date>2019-12-27T15:25:10Z</dc:date>
    </item>
  </channel>
</rss>

