<?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: Count multiple rows as a single row OR how to flatten a table in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Count-multiple-rows-as-a-single-row-OR-how-to-flatten-a-table/m-p/1613964#M63294</link>
    <description>Sorry but i think i didn't make my self clear,&lt;BR /&gt;I would like to do distinct count of the "LoginLog.UserId"&lt;BR /&gt;so basically i will be counting the users each week in 4 segments,&lt;BR /&gt;&lt;BR /&gt;1 . count distinct number of users that have 1 only in W1&lt;BR /&gt;2. count distinct number of users that have 1 in W1 and W2&lt;BR /&gt;3. count distinct number of users that have 1 in W1 and W2 and W3&lt;BR /&gt;4. count distinct number of users that have 1 in W1 and W2 and W3 and W4&lt;BR /&gt;&lt;BR /&gt;is it possible with set analysis?</description>
    <pubDate>Mon, 19 Aug 2019 16:19:05 GMT</pubDate>
    <dc:creator>gal_polak</dc:creator>
    <dc:date>2019-08-19T16:19:05Z</dc:date>
    <item>
      <title>Count multiple rows as a single row OR how to flatten a table</title>
      <link>https://community.qlik.com/t5/App-Development/Count-multiple-rows-as-a-single-row-OR-how-to-flatten-a-table/m-p/1613897#M63292</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a row data table with that indicates login per user in each&amp;nbsp; month,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i also in the load script calculated 4 additional columns (W1 , W2, W3, W4) to indicate in which week on the month the login was made.&amp;nbsp;&lt;/P&gt;&lt;P&gt;now i wounder what is the best approach OR what is do able and how:&lt;/P&gt;&lt;P&gt;1. should i flat the table so instead of having 4 rows for user that logged in each week of the month i will have a single row?&lt;/P&gt;&lt;P&gt;if so how to i do that in the load script in the simplest way?&lt;/P&gt;&lt;P&gt;2. Can i just count the user with a condition in set analysis?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is what i have, and i added in paint the lines (counts) that i want to do in the line chart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_1.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17289i33A9627B0469C802/image-size/medium?v=v2&amp;amp;px=400" role="button" title="clipboard_image_1.png" alt="clipboard_image_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope my question is clear &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Apr 2021 08:04:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-multiple-rows-as-a-single-row-OR-how-to-flatten-a-table/m-p/1613897#M63292</guid>
      <dc:creator>gal_polak</dc:creator>
      <dc:date>2021-04-02T08:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count multiple rows as a single row OR how to flatten a table</title>
      <link>https://community.qlik.com/t5/App-Development/Count-multiple-rows-as-a-single-row-OR-how-to-flatten-a-table/m-p/1613901#M63293</link>
      <description>&lt;P&gt;Yes to both questions.&lt;/P&gt;&lt;P&gt;You should easily be able to do this in script:&lt;/P&gt;&lt;P&gt;Load UserID, Month, Field1, Field2, Count(W1) as W1, Count(W2) as W2, Count(W3) as W3, Count(W4) as W4&lt;/P&gt;&lt;P&gt;From YourTable&lt;/P&gt;&lt;P&gt;GROUP BY UserID, Month, FIeld1, FIeld2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you prefer, you can do a simple user count per week even if it's four rows rather than one row. Just count(W1)+Count(W2)+Count(W3)+Count(W4).&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 14:37:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-multiple-rows-as-a-single-row-OR-how-to-flatten-a-table/m-p/1613901#M63293</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2019-08-19T14:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Count multiple rows as a single row OR how to flatten a table</title>
      <link>https://community.qlik.com/t5/App-Development/Count-multiple-rows-as-a-single-row-OR-how-to-flatten-a-table/m-p/1613964#M63294</link>
      <description>Sorry but i think i didn't make my self clear,&lt;BR /&gt;I would like to do distinct count of the "LoginLog.UserId"&lt;BR /&gt;so basically i will be counting the users each week in 4 segments,&lt;BR /&gt;&lt;BR /&gt;1 . count distinct number of users that have 1 only in W1&lt;BR /&gt;2. count distinct number of users that have 1 in W1 and W2&lt;BR /&gt;3. count distinct number of users that have 1 in W1 and W2 and W3&lt;BR /&gt;4. count distinct number of users that have 1 in W1 and W2 and W3 and W4&lt;BR /&gt;&lt;BR /&gt;is it possible with set analysis?</description>
      <pubDate>Mon, 19 Aug 2019 16:19:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-multiple-rows-as-a-single-row-OR-how-to-flatten-a-table/m-p/1613964#M63294</guid>
      <dc:creator>gal_polak</dc:creator>
      <dc:date>2019-08-19T16:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Count multiple rows as a single row OR how to flatten a table</title>
      <link>https://community.qlik.com/t5/App-Development/Count-multiple-rows-as-a-single-row-OR-how-to-flatten-a-table/m-p/1614176#M63295</link>
      <description>&lt;P&gt;If you pre-calculated these in the script, you should just be able to check them. If you didn't fully pre-calculate (that is, you didn't check the "only" aspect, just the yes/no for each one individually), you should be able to do this in set analysis with the '-' operator (Exclusion - first but not the other). I can't test this as I don't have your data but the code should look something like this:&lt;/P&gt;&lt;P&gt;Count(DISTINCT {&amp;lt; W1 ={1} , W2 -= {1}, W3 -= {1}, W4 -= {1}&amp;nbsp; &amp;gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a Henric post about this aspect of set analysis that shows a couple of other approaches and explains the differences:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Excluding-values-in-Set-Analysis/ba-p/1471704" target="_self"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Excluding-values-in-Set-Analysis/ba-p/1471704&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 08:18:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-multiple-rows-as-a-single-row-OR-how-to-flatten-a-table/m-p/1614176#M63295</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2019-08-20T08:18:29Z</dc:date>
    </item>
  </channel>
</rss>

