<?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: Order of modifiers in element function, E() produce different results? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Order-of-modifiers-in-element-function-E-produce-different/m-p/1704787#M455676</link>
    <description>&lt;P&gt;shouldn't set operators e() be used like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;count (DISTINCT {$&amp;lt;Status={"Completed"},OrderId = &lt;FONT color="#008000"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt;&lt;/FONT&gt;({1&amp;lt;SubOrderCounter = {"&amp;gt;=2"}&amp;gt;}) &lt;FONT color="#008000"&gt;+ &lt;STRONG&gt;E&lt;/STRONG&gt;&lt;/FONT&gt;({1&amp;lt;OrderedBy = {'Z'}&amp;gt;})&amp;gt;}OrderId)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;additionnally... expected result would be 5?&amp;nbsp;&lt;/P&gt;&lt;P&gt;E({1&amp;lt;SubOrderCounter = {"&amp;gt;=2"}&amp;gt;}) == {1,2,3,4,5,6}&lt;/P&gt;&lt;P&gt;E({1&amp;lt;OrderedBy = {'Z'}&amp;gt;}) == {1,2,3,4,5,6,7,8}&lt;/P&gt;&lt;P&gt;==&amp;gt; {1,2,3,4,5,6,7,8}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;completed = {3,4,5,6,8,9,10}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;==&amp;gt; orderID in final set = {3,4,5,6,8}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no idea what results are calculated with you expressions... but yes... they give unexpected results. (but your expressions are also unexpected &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; )&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 24 May 2020 18:59:25 GMT</pubDate>
    <dc:creator>mikaelsc</dc:creator>
    <dc:date>2020-05-24T18:59:25Z</dc:date>
    <item>
      <title>Order of modifiers in element function, E() produce different results?</title>
      <link>https://community.qlik.com/t5/QlikView/Order-of-modifiers-in-element-function-E-produce-different/m-p/1694932#M455674</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have been working with various set expressions with large data sets (10mill+ row) and I found that set expressions&amp;nbsp; produce various results depending of the order of set modifiers within&amp;nbsp;element function, E() and the data model.&lt;/P&gt;&lt;P&gt;I have created a small sample set to reproduce the case with only 10 data rows,&lt;BR /&gt;using two different models.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Model 1&lt;/STRONG&gt;: - single fact table&lt;BR /&gt;&lt;STRONG&gt;Model 2&lt;/STRONG&gt;: - two tables linked with common field, OrderId.&lt;/P&gt;&lt;P&gt;I have used two different formulas to calculate the number of orders,&lt;BR /&gt;fullfilling the critreria, with the only difference being order of the set modifiers.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Formula 1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;count (DISTINCT {$&amp;lt;Status={"Completed"},OrderId = E({&lt;BR /&gt;&lt;FONT color="#800000"&gt;&lt;STRONG&gt;1&amp;lt;OrderedBy={"Z"}&amp;gt; +1 &amp;lt;SubOrderCounter={"&amp;gt;=2"}&amp;gt;}&lt;/STRONG&gt;)&lt;/FONT&gt; &amp;gt;} OrderId)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Formula 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;count (DISTINCT {$&amp;lt;Status={"Completed"},OrderId = E({&lt;BR /&gt;&lt;FONT color="#800000"&gt;&lt;STRONG&gt;1 &amp;lt;SubOrderCounter={"&amp;gt;=2"}&amp;gt; +1&amp;lt;OrderedBy={"Z"}&amp;gt; }&lt;/STRONG&gt;)&lt;/FONT&gt; &amp;gt;} OrderId)&lt;/P&gt;&lt;P&gt;In Data Model 2 I get result = 5, while I was expecting =4, which would be inline with data model 1.&lt;BR /&gt;&lt;BR /&gt;I have spend lots of time analysing the issue, but I can't figure it out why different results are produced.&lt;BR /&gt;Matematically - adding two different sets I form a larger union between them&lt;BR /&gt;and the order should not matter.&lt;BR /&gt;What have I omitted?&lt;BR /&gt;&lt;BR /&gt;I would appreciate guidance from the experts in the community.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Adam&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="overview.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/32140iCC575E63A017D8B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="overview.png" alt="overview.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Code for the data models:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;QUALIFY *;&lt;BR /&gt;O:&lt;BR /&gt;Load * Inline&lt;BR /&gt;[OrderId, SubOrderCounter, OrderedBy, Status,Delivery&lt;BR /&gt;1, 1, A, Ordered, Preliminary&lt;BR /&gt;2, 1, B, Ordered, Preliminary&lt;BR /&gt;3, 1, C, Completed, Delivered&lt;BR /&gt;4, 1, D, Completed, Delivered&lt;BR /&gt;5, 1, E, Completed, Delivered&lt;BR /&gt;6, 1, F, Completed, Delivered&lt;BR /&gt;7, 2, A, Cancelled, Cancelled&lt;BR /&gt;8, 2, A, Completed, Delivered&lt;BR /&gt;9, 2, Z, Completed, Delivered&lt;BR /&gt;10,2, Z, Completed, Delivered&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;UNQUALIFY *;&lt;/P&gt;&lt;P&gt;Orders:&lt;BR /&gt;Load * Inline&lt;BR /&gt;[OrderId, Status,Delivery&lt;BR /&gt;1, Ordered, Preliminary&lt;BR /&gt;2, Ordered, Preliminary&lt;BR /&gt;3, Completed, Delivered&lt;BR /&gt;4, Completed, Delivered&lt;BR /&gt;5, Completed, Delivered&lt;BR /&gt;6, Completed, Delivered&lt;BR /&gt;7, Cancelled, Cancelled&lt;BR /&gt;8, Completed, Delivered&lt;BR /&gt;9, Completed, Delivered&lt;BR /&gt;10,Completed, Delivered&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;OrderData:&lt;BR /&gt;Load * Inline&lt;BR /&gt;[OrderId, SubOrderCounter, OrderedBy&lt;BR /&gt;1, 1, A&lt;BR /&gt;2, 1, B&lt;BR /&gt;3, 1, C&lt;BR /&gt;4, 1, D&lt;BR /&gt;5, 1, E&lt;BR /&gt;6, 1, F&lt;BR /&gt;7, 2, A&lt;BR /&gt;8, 2, A&lt;BR /&gt;9, 2, Z&lt;BR /&gt;10,2, Z&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;The samples app is attached as well.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 00:48:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-of-modifiers-in-element-function-E-produce-different/m-p/1694932#M455674</guid>
      <dc:creator>Astelmach</dc:creator>
      <dc:date>2024-11-16T00:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Order of modifiers in element function, E() produce different results?</title>
      <link>https://community.qlik.com/t5/QlikView/Order-of-modifiers-in-element-function-E-produce-different/m-p/1704762#M455675</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I lokked into this problem a bit more. So far I have not been able to find an answer to this problem. The associated data model (two-tables) is not able to exclude the order that fulfills the criteria of element function.&lt;/P&gt;&lt;P&gt;I have even excluded&amp;nbsp; the searching with "", but results are the same.&lt;BR /&gt;&lt;BR /&gt;count (DISTINCT {$&amp;lt;&lt;BR /&gt;Status={Completed}&lt;BR /&gt;,OrderId = E({&lt;BR /&gt;&amp;lt;OrderedBy={Z}&amp;gt;&lt;BR /&gt;+ &amp;lt;SubOrderCounter={2}&amp;gt;&lt;BR /&gt;})&lt;BR /&gt;&amp;gt;} OrderId)&lt;/P&gt;&lt;P&gt;Mathematically the + sign between modifiers builds a new union between the two modifiers. Order - orderedBy by Z having subOrderCounter = 2 should be in that set and hence be excluded.&lt;/P&gt;&lt;P&gt;The workaround is the use negating modifier outside the element function.&lt;BR /&gt;count (DISTINCT {$&amp;lt;&lt;BR /&gt;Status={Completed}&lt;BR /&gt;,&lt;STRONG&gt;SubOrderCounter-={2}&lt;/STRONG&gt;&lt;BR /&gt;,OrderId = E({&lt;BR /&gt;&amp;lt;OrderedBy={Z}&amp;gt;&lt;BR /&gt;+ &amp;lt;SubOrderCounter={2}&amp;gt;&lt;BR /&gt;})&lt;BR /&gt;&amp;gt;} OrderId)&lt;/P&gt;&lt;P&gt;This gives the correct result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anybody experienced similar issue and how to solve it?&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6622"&gt;@hic&lt;/a&gt;&amp;nbsp; Henric - would you be able to comment this?&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Adam&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 13:42:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-of-modifiers-in-element-function-E-produce-different/m-p/1704762#M455675</guid>
      <dc:creator>Astelmach</dc:creator>
      <dc:date>2020-05-24T13:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Order of modifiers in element function, E() produce different results?</title>
      <link>https://community.qlik.com/t5/QlikView/Order-of-modifiers-in-element-function-E-produce-different/m-p/1704787#M455676</link>
      <description>&lt;P&gt;shouldn't set operators e() be used like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;count (DISTINCT {$&amp;lt;Status={"Completed"},OrderId = &lt;FONT color="#008000"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt;&lt;/FONT&gt;({1&amp;lt;SubOrderCounter = {"&amp;gt;=2"}&amp;gt;}) &lt;FONT color="#008000"&gt;+ &lt;STRONG&gt;E&lt;/STRONG&gt;&lt;/FONT&gt;({1&amp;lt;OrderedBy = {'Z'}&amp;gt;})&amp;gt;}OrderId)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;additionnally... expected result would be 5?&amp;nbsp;&lt;/P&gt;&lt;P&gt;E({1&amp;lt;SubOrderCounter = {"&amp;gt;=2"}&amp;gt;}) == {1,2,3,4,5,6}&lt;/P&gt;&lt;P&gt;E({1&amp;lt;OrderedBy = {'Z'}&amp;gt;}) == {1,2,3,4,5,6,7,8}&lt;/P&gt;&lt;P&gt;==&amp;gt; {1,2,3,4,5,6,7,8}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;completed = {3,4,5,6,8,9,10}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;==&amp;gt; orderID in final set = {3,4,5,6,8}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no idea what results are calculated with you expressions... but yes... they give unexpected results. (but your expressions are also unexpected &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; )&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 18:59:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-of-modifiers-in-element-function-E-produce-different/m-p/1704787#M455676</guid>
      <dc:creator>mikaelsc</dc:creator>
      <dc:date>2020-05-24T18:59:25Z</dc:date>
    </item>
  </channel>
</rss>

