<?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 I am stuck in a logic for which involves intersection in set analysis. in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/I-am-stuck-in-a-logic-for-which-involves-intersection-in-set/m-p/2056148#M86757</link>
    <description>&lt;P&gt;Test:&lt;BR /&gt;Load*Inline [&lt;/P&gt;
&lt;P&gt;Month,user_id&lt;BR /&gt;jan,1&lt;BR /&gt;jan,2&lt;BR /&gt;jan,3&lt;BR /&gt;jan,4&lt;BR /&gt;jan,5&lt;BR /&gt;jan,6&lt;BR /&gt;jan,7&lt;BR /&gt;jan,8&lt;BR /&gt;jan,9&lt;BR /&gt;feb,1&lt;BR /&gt;feb,5&lt;BR /&gt;feb,10&lt;BR /&gt;feb,11&lt;BR /&gt;feb,12&lt;BR /&gt;March,1&lt;BR /&gt;March,2&lt;BR /&gt;March,3&lt;BR /&gt;March,13&lt;BR /&gt;March,15];&lt;/P&gt;
&lt;P&gt;exit script;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my data set.&lt;/P&gt;
&lt;P&gt;Now my requirement is that i want to have a ratio which should be equal to no of user_id repeated in march from jan but they should not be included in feb.&lt;/P&gt;
&lt;P&gt;for example there are 9 user_id in jan and out of which 2 are repeating in feb i.e, 1 and 5 so we will remove that from the base of jan and it comes out to be 7 user_id now we will move to march and we can see that march and jan has 3 common user_id which are 1,2 and 3 but 1 has already been removed while calculating feb user_id so now 2 and 3 remains which are common between jan and feb so now our ration should be common/base which is 2/9.&lt;/P&gt;
&lt;P&gt;In short i want a metric named as M-2 which means my denominator will jan and numerator will be common user_id between jan and march but it should not include the user_id which already has been removed in feb month as mentioned in above example.&lt;/P&gt;
&lt;P&gt;I tried this in M-1 scenario and it works in that&amp;nbsp;&lt;/P&gt;
&lt;P&gt;formula i used is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=sum(aggr(count({&amp;lt;Month={'jan'}&amp;gt;}distinct user_id)&lt;BR /&gt;*&lt;BR /&gt;count({&amp;lt;Month={'feb'}&amp;gt;}distinct user_id),user_id))&lt;/P&gt;
&lt;P&gt;Please help in the second metric which M-2 mentioned in starting.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Rajat&lt;/P&gt;</description>
    <pubDate>Mon, 03 Apr 2023 11:25:04 GMT</pubDate>
    <dc:creator>Rajat1</dc:creator>
    <dc:date>2023-04-03T11:25:04Z</dc:date>
    <item>
      <title>I am stuck in a logic for which involves intersection in set analysis.</title>
      <link>https://community.qlik.com/t5/App-Development/I-am-stuck-in-a-logic-for-which-involves-intersection-in-set/m-p/2056148#M86757</link>
      <description>&lt;P&gt;Test:&lt;BR /&gt;Load*Inline [&lt;/P&gt;
&lt;P&gt;Month,user_id&lt;BR /&gt;jan,1&lt;BR /&gt;jan,2&lt;BR /&gt;jan,3&lt;BR /&gt;jan,4&lt;BR /&gt;jan,5&lt;BR /&gt;jan,6&lt;BR /&gt;jan,7&lt;BR /&gt;jan,8&lt;BR /&gt;jan,9&lt;BR /&gt;feb,1&lt;BR /&gt;feb,5&lt;BR /&gt;feb,10&lt;BR /&gt;feb,11&lt;BR /&gt;feb,12&lt;BR /&gt;March,1&lt;BR /&gt;March,2&lt;BR /&gt;March,3&lt;BR /&gt;March,13&lt;BR /&gt;March,15];&lt;/P&gt;
&lt;P&gt;exit script;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my data set.&lt;/P&gt;
&lt;P&gt;Now my requirement is that i want to have a ratio which should be equal to no of user_id repeated in march from jan but they should not be included in feb.&lt;/P&gt;
&lt;P&gt;for example there are 9 user_id in jan and out of which 2 are repeating in feb i.e, 1 and 5 so we will remove that from the base of jan and it comes out to be 7 user_id now we will move to march and we can see that march and jan has 3 common user_id which are 1,2 and 3 but 1 has already been removed while calculating feb user_id so now 2 and 3 remains which are common between jan and feb so now our ration should be common/base which is 2/9.&lt;/P&gt;
&lt;P&gt;In short i want a metric named as M-2 which means my denominator will jan and numerator will be common user_id between jan and march but it should not include the user_id which already has been removed in feb month as mentioned in above example.&lt;/P&gt;
&lt;P&gt;I tried this in M-1 scenario and it works in that&amp;nbsp;&lt;/P&gt;
&lt;P&gt;formula i used is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=sum(aggr(count({&amp;lt;Month={'jan'}&amp;gt;}distinct user_id)&lt;BR /&gt;*&lt;BR /&gt;count({&amp;lt;Month={'feb'}&amp;gt;}distinct user_id),user_id))&lt;/P&gt;
&lt;P&gt;Please help in the second metric which M-2 mentioned in starting.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Rajat&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 11:25:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/I-am-stuck-in-a-logic-for-which-involves-intersection-in-set/m-p/2056148#M86757</guid>
      <dc:creator>Rajat1</dc:creator>
      <dc:date>2023-04-03T11:25:04Z</dc:date>
    </item>
  </channel>
</rss>

