<?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: Convert start/stop to list of days in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Convert-start-stop-to-list-of-days/m-p/1426066#M34043</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This could well be a candidate for the IntervalMatch() function as described in this Blog &lt;A href="https://community.qlik.com/qlik-blogpost/3037"&gt;IntervalMatch&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the concepts are identical QlikView vs Sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Sep 2017 17:00:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-09-15T17:00:08Z</dc:date>
    <item>
      <title>Convert start/stop to list of days</title>
      <link>https://community.qlik.com/t5/App-Development/Convert-start-stop-to-list-of-days/m-p/1426065#M34042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've spent some time searching online for a solution to this but most of the examples I run into use dates/times to create ranges and it doesn't seem to fit our use case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have data stored in a database in the format below describing when a user performs an "action". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to re-format this data to show which users performed an action each day.&amp;nbsp; The total number of actions per user do not matter, I just need to know active/inactive (0/1) for each user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Source Data:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;User Id&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Action Start Day&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Action End Day&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;'A'&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;'B'&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;'C'&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;'A'&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="50" style="border: 1px solid #000000; width: 188px; height: 30px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;SourceData:&lt;/P&gt;&lt;P&gt;LOAD * Inline [&lt;/P&gt;&lt;P&gt;User, StartDay, EndDay&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'A', 1, 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'B', 3, 4&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'C', 5, 5&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'A', 1, 3&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data represents "users" and the days they performed an action.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;User 'A' started an action on day 1, then finished on day 1.&lt;/P&gt;&lt;P&gt;User 'B' started an action on day 3, then finished on day 4.&lt;/P&gt;&lt;P&gt;User 'C' started an action on day 5, then finished on day 5.&lt;/P&gt;&lt;P&gt;User 'A' started another action on day 1, then finished that action on day 3. (actions can span days and overlap with other actions)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;User 'A' performed 2 actions on day 1, but we only care if &lt;EM&gt;any&lt;/EM&gt; action was performed that day or not.&amp;nbsp; We don't need the total number of actions.&amp;nbsp; The data could have "overlaps" in multiple rows, but we don't care about the total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to convert this to the following format showing "buckets" representing days each user performed an action: (if you have a better suggestion to format the data, I am open to ideas)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Desired output data to visualize in QlikSense:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;User&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Day 1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Day 2&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Day 3&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Day 4&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Day 5&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Day 6&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;'A'&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;'B'&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;'C'&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Total&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The goal of the output table is to create a "Total" of all active users per day, so we can visualize that total for each day by totaling each Day.&amp;nbsp; Note that User 'A' was performed 2 actions on day 1 in the source table, but each user is only counted once in the output table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; The example above is simplified.&amp;nbsp; There are 100+ days in our output table, so hopefully there's a way to do this without assigning each day in the load script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;On day 1: 1 user was active&lt;/P&gt;&lt;P&gt;On day 2: 1 user was active&lt;/P&gt;&lt;P&gt;On day 3, 2 users were active&lt;/P&gt;&lt;P&gt;etc.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not married to the data formats above, although the first table represents an over-simplified version of how our data is currently stored in the database.&amp;nbsp; We can change that format if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas/suggestions on how to translate the first table into the 2nd table?&amp;nbsp; Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2017 16:18:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Convert-start-stop-to-list-of-days/m-p/1426065#M34042</guid>
      <dc:creator />
      <dc:date>2017-09-15T16:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert start/stop to list of days</title>
      <link>https://community.qlik.com/t5/App-Development/Convert-start-stop-to-list-of-days/m-p/1426066#M34043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This could well be a candidate for the IntervalMatch() function as described in this Blog &lt;A href="https://community.qlik.com/qlik-blogpost/3037"&gt;IntervalMatch&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the concepts are identical QlikView vs Sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2017 17:00:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Convert-start-stop-to-list-of-days/m-p/1426066#M34043</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-15T17:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert start/stop to list of days</title>
      <link>https://community.qlik.com/t5/App-Development/Convert-start-stop-to-list-of-days/m-p/1426067#M34044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SourceData:&lt;/P&gt;&lt;P&gt;LOAD * Inline [&lt;/P&gt;&lt;P&gt;User, StartDay, EndDay&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'A', 1, 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'B', 3, 4&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'C', 5, 5&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'A', 1, 3&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;Load RowNo() as Day&lt;/P&gt;&lt;P&gt;AutoGenerate 10;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interval:&lt;/P&gt;&lt;P&gt;IntervalMatch (Day)&lt;/P&gt;&lt;P&gt;Load StartDay, EndDay Resident SourceData;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After reloading this script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a pivot table with Day and User as dimension and Count(Distinct User) as expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2017 17:06:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Convert-start-stop-to-list-of-days/m-p/1426067#M34044</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2017-09-15T17:06:29Z</dc:date>
    </item>
  </channel>
</rss>

