<?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: set expression does not work until selecting particular dimensions in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2507095#M104292</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For a small dataset, I'd use the following IF condition:&lt;/P&gt;
&lt;P&gt;SUM( IF(Date1&amp;lt;Date2, Sales))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To calculate this as a conditional flag in the script, I'd use something like this (assuming that both dates are stored in the same table):&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;...,&lt;/P&gt;
&lt;P&gt;IF(Date1 &amp;lt; Date2, 1, 0)&amp;nbsp; &amp;nbsp; as _Date_Flag,&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Then, your set analysis expression would look like this:&lt;/P&gt;
&lt;P&gt;Sum( {&amp;lt;_Date_Flag={1}&amp;gt;} Sales)&lt;/P&gt;
&lt;P&gt;These are very basic developer techniques that all new developers learn either by attending a training class, or by reading one of the tutorial books for beginners (like mine).&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
    <pubDate>Mon, 24 Feb 2025 15:34:48 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2025-02-24T15:34:48Z</dc:date>
    <item>
      <title>set expression does not work until selecting particular dimensions</title>
      <link>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506931#M104263</link>
      <description>&lt;P&gt;not sure if this is to due with null value or the feature of&amp;nbsp; different values at a field (opportunity date) I want to build with set expression.&lt;/P&gt;
&lt;P&gt;so I have a fact table contains "customer", "contract sales", "Salesdate"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then I add a island table by "Customer" to have "opportunity stage", "opportunity date” ; both fields have different stage type or dates for different customers.&lt;/P&gt;
&lt;P&gt;I want to build a very simple KPI to aggregate the sales to show&lt;/P&gt;
&lt;P&gt;how much sales those customers with the opportunity stage as "A" look like 6 months prior to opportunity date&lt;/P&gt;
&lt;P&gt;so I thought this should be a simple set expression like this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;&lt;BR /&gt;[Opportunity Stage] = {'A'},Saledate = {"&amp;lt;$(=AddMonths(opportunity date, -6))"}&lt;BR /&gt;&amp;gt;} [Contract Sales])&lt;/P&gt;
&lt;P&gt;but the KPI wont return anything unless I hit specific customer and select A at the field of Opportunity Stage.&lt;/P&gt;
&lt;P&gt;and idea what I am missing?&lt;/P&gt;
&lt;P&gt;I tried to left join the table to stack opportunity date and type on the FACT table, still does not work.&lt;/P&gt;
&lt;P&gt;please advise.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 16:33:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506931#M104263</guid>
      <dc:creator>coloful_architect</dc:creator>
      <dc:date>2025-02-21T16:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: set expression does not work until selecting particular dimensions</title>
      <link>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506933#M104264</link>
      <description>&lt;P&gt;Try this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;&lt;/P&gt;
&lt;P&gt;[Opportunity Stage] = {'A'},&lt;/P&gt;
&lt;P&gt;Salesdate = {"&amp;lt;$(=Max({&amp;lt;[Opportunity Stage]={'A'}&amp;gt;} [Opportunity Date]) - 6)"}&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;} [Contract Sale&lt;/P&gt;
&lt;P&gt;s])&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 16:55:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506933#M104264</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2025-02-21T16:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: set expression does not work until selecting particular dimensions</title>
      <link>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506948#M104268</link>
      <description>&lt;P&gt;but if using MAX(), that turns to find the &lt;STRONG&gt;single&lt;/STRONG&gt; latest time among all the opportunity date and from there to calculate the sales. I am looking for the aggregation for sales from those customers who they have different opportunity date.&amp;nbsp; one could be Feb, one could be Mar, I want to have the sum to include all of them who they have different opportunity dates.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 20:19:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506948#M104268</guid>
      <dc:creator>coloful_architect</dc:creator>
      <dc:date>2025-02-21T20:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: set expression does not work until selecting particular dimensions</title>
      <link>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506949#M104269</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;It appears to me that you misunderstand how Set Analysis works (no offence!). Your condition could work within an IF() function, which would be performed for each detailed row of the data, hence comparing the two dates would be valid.&lt;/P&gt;
&lt;P&gt;Set Analysis conditions, however, are validated globally, outside of the scope of your chart. So, when you are comparing Sales Date to the Opportunity Date - 6 months, this comparison is not done at the individual data row level, but rather globally, and that is why the expression doesn't produce any data until you make selections to render a unique value of the opportunity date.&lt;/P&gt;
&lt;P&gt;So, if I were to offer the solution, I'd suggest one of the two - if the data is relatively small (less than a few millions of rows), then use the IF() function, even though it's slower than using Set Analysis.&lt;/P&gt;
&lt;P&gt;If your data can be bigger than that, then try to calculate this condition as a conditional flag in the script and use the flag in Set Analysis. Also, with larger data sets avoid data islands at all costs - they will eventually bring your server down. Definitely link your tables by Customer, to improve performance.&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 20:46:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506949#M104269</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2025-02-21T20:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: set expression does not work until selecting particular dimensions</title>
      <link>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506950#M104270</link>
      <description>&lt;P&gt;none take. come here to learn. so Oleg, can you give me a rough example of set expression if the data set is small? how do I do the If () ...just a broad way if you dont mind&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and regarding the script load version, what kind of conditional flag you suggest, mind elaborating a bit more?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 20:53:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2506950#M104270</guid>
      <dc:creator>coloful_architect</dc:creator>
      <dc:date>2025-02-21T20:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: set expression does not work until selecting particular dimensions</title>
      <link>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2507095#M104292</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For a small dataset, I'd use the following IF condition:&lt;/P&gt;
&lt;P&gt;SUM( IF(Date1&amp;lt;Date2, Sales))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To calculate this as a conditional flag in the script, I'd use something like this (assuming that both dates are stored in the same table):&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;...,&lt;/P&gt;
&lt;P&gt;IF(Date1 &amp;lt; Date2, 1, 0)&amp;nbsp; &amp;nbsp; as _Date_Flag,&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Then, your set analysis expression would look like this:&lt;/P&gt;
&lt;P&gt;Sum( {&amp;lt;_Date_Flag={1}&amp;gt;} Sales)&lt;/P&gt;
&lt;P&gt;These are very basic developer techniques that all new developers learn either by attending a training class, or by reading one of the tutorial books for beginners (like mine).&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2025 15:34:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/set-expression-does-not-work-until-selecting-particular/m-p/2507095#M104292</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2025-02-24T15:34:48Z</dc:date>
    </item>
  </channel>
</rss>

