<?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 Analysis: use aggregation over combination of dimensions as condition in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076547#M88286</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/155989"&gt;@Kellerassel&lt;/a&gt;&amp;nbsp; Data example will be essential here to give you correct answer.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 May 2023 00:04:10 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2023-05-26T00:04:10Z</dc:date>
    <item>
      <title>Set Analysis: use aggregation over combination of dimensions as condition</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076265#M88272</link>
      <description>&lt;P&gt;I have a set expression that works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Min({&amp;lt;employee = {"=Count(Distinct transaction) &amp;gt; 1"}&amp;gt;} date)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The example is hypothetical:&lt;/P&gt;
&lt;P&gt;A data set of transactions by employees in departments.&amp;nbsp;&lt;SPAN&gt;A Table with department as dimension.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The above formula should give me for each department the earliest date of a transaction made by an employee&amp;nbsp; that has &lt;EM&gt;overall&lt;/EM&gt;&amp;nbsp;completed more than one transaction. Right?&lt;BR /&gt;&lt;BR /&gt;But I would like to have the earliest date an employee has completed at least two transactions on the same day.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So&amp;nbsp;&lt;EM&gt;Count(Distinct transaction) &amp;gt; 1 &lt;/EM&gt;has to be true for a combination of &lt;EM&gt;employee and date&lt;/EM&gt; for the &lt;EM&gt;employee&lt;/EM&gt;&amp;nbsp;to be the selected by the set expression.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;ChatGPT has funnily enough suggested this solution wich is rubbish, but it illustrates what I'm looking for:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Min({&amp;lt;employee &amp;amp; date = {"=Count(Distinct transaction) &amp;gt; 1"}&amp;gt;} date)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can this be done?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 05:53:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076265#M88272</guid>
      <dc:creator>Kellerassel</dc:creator>
      <dc:date>2023-05-26T05:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis: use aggregation over combination of dimensions as condition</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076403#M88273</link>
      <description>&lt;P&gt;Hi Kellerassel,&lt;/P&gt;
&lt;P&gt;you can achieve this in your Data Load Editor. To give you an Idea, the script could look like this. You just have to adjust the Table and Fieldnames:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Transactions_by_employee:

Load

Count(Distinct Transactions) as CountTransaction,

Employee,

Date

From Transactions

Group by Employee, Date;


FirstTimeTwoTransactions:
Load
Min(Date) as FirstDate,
Employee
From Transactions_by_employee
Where CountTransaction &amp;gt; 1
Group by Employee;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if that helped&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Can&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 15:20:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076403#M88273</guid>
      <dc:creator>canerkan</dc:creator>
      <dc:date>2023-05-25T15:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis: use aggregation over combination of dimensions as condition</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076476#M88275</link>
      <description>&lt;P&gt;Thanks for you response! However I can't adjust the skript for that, so I am looking for a solution with chart functions, and out of a special interest a solution with set expressions.&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 17:12:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076476#M88275</guid>
      <dc:creator>Kellerassel</dc:creator>
      <dc:date>2023-05-25T17:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis: use aggregation over combination of dimensions as condition</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076500#M88280</link>
      <description>&lt;P&gt;&amp;nbsp;I have a formula:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date(Aggr(Min(Aggr(Min({&amp;lt;date = {"=Count(DISTINCT transaction) &amp;gt; 1"}&amp;gt;} date), department, employee)), department))
&lt;/LI-CODE&gt;
&lt;P&gt;But this only works if I filter one or more departments from the table. &lt;BR /&gt;&lt;BR /&gt;Without filtering, just department as a table dimension, it gives me a wrong date. I can see the date output flip when selecting and deselecting a department. I'm very confused.&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 19:19:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076500#M88280</guid>
      <dc:creator>Kellerassel</dc:creator>
      <dc:date>2023-05-25T19:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis: use aggregation over combination of dimensions as condition</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076547#M88286</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/155989"&gt;@Kellerassel&lt;/a&gt;&amp;nbsp; Data example will be essential here to give you correct answer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 00:04:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076547#M88286</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-26T00:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis: use aggregation over combination of dimensions as condition</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076606#M88289</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp;, I can't share company data, but I was able to create a reproducible example with sample data. I have attached a qvf to this question. You will be able to understand my problem with this data.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Example: Department 5 shows me a wrong date in the table, as soon as I select department 5 it shows me the correct value. But this doesn't go for all cases. See for yourself.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 05:56:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076606#M88289</guid>
      <dc:creator>Kellerassel</dc:creator>
      <dc:date>2023-05-26T05:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis: use aggregation over combination of dimensions as condition</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076720#M88304</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/155989"&gt;@Kellerassel&lt;/a&gt;&amp;nbsp; if you are going to use set expression, you need primary key to evaluate your condition in set. I have assumed that transaction_id is your primary_key.If it is not primary key, you can create it using RowNo() function in script. Other option is to use if condition instead if you are not able create primary key in script&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;=min({&amp;lt; transaction_id = {"=aggr(Count(distinct transaction_id), department,employee_id,date)&amp;gt;1"}&amp;gt;}date)

or

=min(aggr(if(Count(distinct transaction_id)&amp;gt;1, date), department,employee_id,date))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 10:36:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-use-aggregation-over-combination-of-dimensions-as/m-p/2076720#M88304</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-26T10:36:31Z</dc:date>
    </item>
  </channel>
</rss>

