<?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: Dimension with sum condition in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982624#M81096</link>
    <description>&lt;P&gt;Hi, in that table you can add the expressions to cehck the calcualted, just add 2 measures:&lt;/P&gt;
&lt;P&gt;-&amp;nbsp;&lt;SPAN&gt;aggr(sum({&amp;lt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;&lt;SPAN&gt;={"&amp;gt;=$(vPrevFrom)&amp;lt;=$(vPrevTo)"}&amp;gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;-&amp;nbsp;&lt;SPAN&gt;aggr(sum({&amp;lt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;&lt;SPAN&gt;={"&amp;lt;$(vPrevFrom)"}&amp;gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And confirm it return the values you expect. Probably both return null because an aggr usually returns many diffeernt values and you need to enclose them in an aggregation function that tells what to do with all that different values, in example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;sum(&lt;/STRONG&gt;&lt;/FONT&gt;aggr(sum({&amp;lt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;={"&amp;gt;=$(vPrevFrom)&amp;lt;=$(vPrevTo)"}&amp;gt;}&amp;nbsp;&lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;),&amp;nbsp;&lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;)&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also note that set analysis is calulated before the table rows, so dimensions values will not have an impact, all rows/dimesnions will apply the same set analysis&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2022 14:20:36 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2022-09-19T14:20:36Z</dc:date>
    <item>
      <title>Dimension with sum condition</title>
      <link>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982587#M81093</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;I am trying to create a dimension that will contain 1 or 0, depending on the condition of the cost sum in orders. When I add conditions to the pivot table as separate measures, the sums are calculated correctly and I see that there are many rows for the condition '1'. However, the dimension shows me '0' in 100% of cases.&lt;/P&gt;
&lt;P&gt;I already have another dimension also based on sum conditions and it works fine. Why can't qlik sense correctly detect this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dimension&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#3366FF"&gt;=if( aggr(sum({&amp;lt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;={"&amp;gt;=$(vPrevFrom)&amp;lt;=$(vPrevTo)"}&amp;gt;} &lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;), &lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;) =&lt;FONT color="#FF6600"&gt;0&lt;/FONT&gt; and aggr(sum({&amp;lt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;={"&amp;lt;$(vPrevFrom)"}&amp;gt;} &lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;), &lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;) &amp;gt;&lt;FONT color="#FF6600"&gt;0&lt;/FONT&gt;, '1', '0')&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 13:23:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982587#M81093</guid>
      <dc:creator>ZimaBlue</dc:creator>
      <dc:date>2022-09-19T13:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dimension with sum condition</title>
      <link>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982624#M81096</link>
      <description>&lt;P&gt;Hi, in that table you can add the expressions to cehck the calcualted, just add 2 measures:&lt;/P&gt;
&lt;P&gt;-&amp;nbsp;&lt;SPAN&gt;aggr(sum({&amp;lt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;&lt;SPAN&gt;={"&amp;gt;=$(vPrevFrom)&amp;lt;=$(vPrevTo)"}&amp;gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;-&amp;nbsp;&lt;SPAN&gt;aggr(sum({&amp;lt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;&lt;SPAN&gt;={"&amp;lt;$(vPrevFrom)"}&amp;gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And confirm it return the values you expect. Probably both return null because an aggr usually returns many diffeernt values and you need to enclose them in an aggregation function that tells what to do with all that different values, in example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;sum(&lt;/STRONG&gt;&lt;/FONT&gt;aggr(sum({&amp;lt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;={"&amp;gt;=$(vPrevFrom)&amp;lt;=$(vPrevTo)"}&amp;gt;}&amp;nbsp;&lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;),&amp;nbsp;&lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;)&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also note that set analysis is calulated before the table rows, so dimensions values will not have an impact, all rows/dimesnions will apply the same set analysis&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 14:20:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982624#M81096</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-09-19T14:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dimension with sum condition</title>
      <link>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982850#M81111</link>
      <description>&lt;P&gt;Hello!&amp;nbsp;I tried inserting your expressions a measure and it doesn't display the correct values, it works as a measure only without &lt;FONT face="courier new,courier" color="#3366FF"&gt;aggr&lt;/FONT&gt; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; I use aggr only for dimension, because as far as I understand, including the formula in the dimensions does not work without aggr.&lt;/P&gt;
&lt;P&gt;At the same time, I have an absolutely identical dimension that displays the correct values. Another dimension is&amp;nbsp;&lt;FONT face="courier new,courier" color="#3366FF"&gt;if( aggr(sum({&amp;lt;order_date={"&amp;gt;=$(v30d)&amp;lt;=$(vToday)"}&amp;gt;} order_cost), user_id) &amp;gt;= 50000, '1. Qextra (50k+)', 'Low')&lt;/FONT&gt;.&amp;nbsp;The logic of the formula is the same. I tried to copy this dimension, but replace 'qextra' and 'low' with 1 and 0 - it works fine.&lt;/P&gt;
&lt;P&gt;I also tried using the option&amp;nbsp;&lt;FONT face="courier new,courier" color="#3366FF"&gt;aggr(if( sum({&amp;lt;order_date={"&amp;gt;=$(v30d)&amp;lt;=$(vToday)"}&amp;gt;} order_cost) &amp;lt;1, '1', '0'), user_id)&lt;/FONT&gt;&amp;nbsp;and in this case I get null where there should be 1 and 0 for all 0.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are some problems with comparing numbers with 0 in dimensions with formula. I try to use the condition &lt;FONT face="courier new,courier" color="#3366FF"&gt;=0&lt;/FONT&gt; or &lt;FONT face="courier new,courier" color="#3366FF"&gt;&amp;lt;1&lt;/FONT&gt; and it cannot work with this correctly for some reason&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 04:31:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982850#M81111</guid>
      <dc:creator>ZimaBlue</dc:creator>
      <dc:date>2022-09-20T04:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dimension with sum condition</title>
      <link>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982854#M81112</link>
      <description>&lt;P&gt;I replaced dimension with &lt;FONT face="courier new,courier" color="#0000FF"&gt;=if( aggr(sum({&amp;lt;order_date=&lt;SPAN&gt;{"&amp;gt;=$(vPrevFrom)&amp;lt;=$(vPrevTo)"}&lt;/SPAN&gt;&amp;gt;} order_cost), user_id) &amp;gt;=100, '0', '1')&lt;/FONT&gt; and now it works. It's not that 100% suits me, but comparing with 0 and 1 doesn't work at all.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 04:30:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982854#M81112</guid>
      <dc:creator>ZimaBlue</dc:creator>
      <dc:date>2022-09-20T04:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dimension with sum condition</title>
      <link>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982855#M81113</link>
      <description>&lt;P&gt;&lt;SPAN&gt;try this&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if(Sum( aggr(sum({&amp;lt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;&lt;SPAN&gt;={"&amp;gt;=$(vPrevFrom)&amp;lt;=$(vPrevTo)"}&amp;gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;&lt;SPAN&gt;) )=&lt;/SPAN&gt;&lt;FONT color="#FF6600"&gt;0&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;and Sum(aggr(sum({&amp;lt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;&lt;SPAN&gt;={"&amp;lt;$(vPrevFrom)"}&amp;gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;user_id&lt;/FONT&gt;&lt;SPAN&gt;)) &amp;gt;&lt;/SPAN&gt;&lt;FONT color="#FF6600"&gt;0&lt;/FONT&gt;&lt;SPAN&gt;, '1', '0')&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 04:35:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982855#M81113</guid>
      <dc:creator>SunilChauhan</dc:creator>
      <dc:date>2022-09-20T04:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dimension with sum condition</title>
      <link>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982886#M81118</link>
      <description>&lt;P&gt;Hi, you're right, I miss the part when you say it was used as dimension.&lt;/P&gt;
&lt;P&gt;In that case, just to make the test, you can create a table with user_id as dimension, and the expression "&lt;SPAN&gt;sum({&amp;lt;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_date&lt;/FONT&gt;&lt;SPAN&gt;={"&amp;gt;=$(vPrevFrom)&amp;lt;=$(vPrevTo)"}&amp;gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#339966"&gt;order_cost&lt;/FONT&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;" and another with "if( sum({&amp;lt;order_date={"&amp;gt;=$(vPrevFrom)&amp;lt;=$(vPrevTo)"}&amp;gt;} order_cost) =0,1,0)". So you can check if any user_id returns 0, and if it's correctly identified by the 'if'.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And the same with the other expressions you want to test. Hoping to get some hints based on this results.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 06:26:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dimension-with-sum-condition/m-p/1982886#M81118</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-09-20T06:26:49Z</dc:date>
    </item>
  </channel>
</rss>

