<?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 advanced set analysis? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/advanced-set-analysis/m-p/1094362#M18347</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been working on trying to delve further into set analysis and looking to replicate some common examples from my work into some dimension / measures etc and having a bit of a hard time with it.&amp;nbsp; I'd be interested in any feedback from you lot and see if you've had any success with similar issues:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;scenario 1: pivoting data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I'm not talking about a pivot table, but something similar to the what i might do in SQL.&amp;nbsp; I come from the health care industry and a very common request might be to report on the first however many diagnosis codes for a patient.&amp;nbsp; based on the structure of the database i might have something similar to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;patient number | sequence | diagnosis code&lt;/P&gt;&lt;P&gt;123456789&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 1234&lt;/P&gt;&lt;P&gt;123456789&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 2345&lt;/P&gt;&lt;P&gt;123456789&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 3456 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now in SQL i might choose to pivot this information like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT patient number, [1],[2],[3]&lt;/P&gt;&lt;P&gt;FROM table as source&lt;/P&gt;&lt;P&gt;PIVOT (MAX(Diagnosis code FOR Sequence IN ([1],[2],[3])) as pivot table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Giving you&lt;/P&gt;&lt;P&gt;patient number |&amp;nbsp;&amp;nbsp; [1]&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp; [2]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp; [3]&amp;nbsp; &lt;/P&gt;&lt;P&gt;123456789&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 1234&amp;nbsp; |&amp;nbsp; 2345&amp;nbsp; |&amp;nbsp;&amp;nbsp; 3456&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume what you are going to say is that it's best to do this sort of transformation in the data load editor.&amp;nbsp; the problem that i have with that is then that prevents you from having a common set of database tables upon which you can build multiple visualizations.&amp;nbsp; why would i want to have to refresh and maintain multiple instances of the same database tables to account for this type of scenario?&amp;nbsp; wouldn't i ideally be able to do this sort of thing via set analysis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;scenario 2: assign a literal based on a case statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maybe another basic concept.&amp;nbsp; let's say i have a list of facilities and i want to create some sort of dimensional label for a segment of them.&amp;nbsp; in SQL i might do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;CASE WHEN facility = Hospital X THEN 'Main' &lt;/P&gt;&lt;P&gt;WHEN facility = Hospital Y THEN 'Something' &lt;/P&gt;&lt;P&gt;ELSE 'Other' END AS Label&lt;/P&gt;&lt;P&gt;FROM table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here i have evaluated a condition and assigned a new value to it based on the result.&amp;nbsp; Again, I am pretty sure you can do this either via the data load editor or by creating a small reference file, but is there some way to define these things through set analysis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my big concern is, i come from a world where i might have a core set of 9-10 large tables all with millions if not billions of rows of information.&amp;nbsp; does it make sense to have to refresh multiple instances of those tables across multiple dashboard visuals in order to be able to make these types of things happen?&amp;nbsp; I'm hoping that i'm just still inexperienced at set analysis and haven't realized it's full potential.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; interested in the communities feedback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Feb 2016 00:07:31 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-02-11T00:07:31Z</dc:date>
    <item>
      <title>advanced set analysis?</title>
      <link>https://community.qlik.com/t5/App-Development/advanced-set-analysis/m-p/1094362#M18347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been working on trying to delve further into set analysis and looking to replicate some common examples from my work into some dimension / measures etc and having a bit of a hard time with it.&amp;nbsp; I'd be interested in any feedback from you lot and see if you've had any success with similar issues:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;scenario 1: pivoting data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I'm not talking about a pivot table, but something similar to the what i might do in SQL.&amp;nbsp; I come from the health care industry and a very common request might be to report on the first however many diagnosis codes for a patient.&amp;nbsp; based on the structure of the database i might have something similar to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;patient number | sequence | diagnosis code&lt;/P&gt;&lt;P&gt;123456789&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 1234&lt;/P&gt;&lt;P&gt;123456789&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 2345&lt;/P&gt;&lt;P&gt;123456789&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 3456 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now in SQL i might choose to pivot this information like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT patient number, [1],[2],[3]&lt;/P&gt;&lt;P&gt;FROM table as source&lt;/P&gt;&lt;P&gt;PIVOT (MAX(Diagnosis code FOR Sequence IN ([1],[2],[3])) as pivot table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Giving you&lt;/P&gt;&lt;P&gt;patient number |&amp;nbsp;&amp;nbsp; [1]&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp; [2]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp; [3]&amp;nbsp; &lt;/P&gt;&lt;P&gt;123456789&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 1234&amp;nbsp; |&amp;nbsp; 2345&amp;nbsp; |&amp;nbsp;&amp;nbsp; 3456&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume what you are going to say is that it's best to do this sort of transformation in the data load editor.&amp;nbsp; the problem that i have with that is then that prevents you from having a common set of database tables upon which you can build multiple visualizations.&amp;nbsp; why would i want to have to refresh and maintain multiple instances of the same database tables to account for this type of scenario?&amp;nbsp; wouldn't i ideally be able to do this sort of thing via set analysis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;scenario 2: assign a literal based on a case statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maybe another basic concept.&amp;nbsp; let's say i have a list of facilities and i want to create some sort of dimensional label for a segment of them.&amp;nbsp; in SQL i might do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;CASE WHEN facility = Hospital X THEN 'Main' &lt;/P&gt;&lt;P&gt;WHEN facility = Hospital Y THEN 'Something' &lt;/P&gt;&lt;P&gt;ELSE 'Other' END AS Label&lt;/P&gt;&lt;P&gt;FROM table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here i have evaluated a condition and assigned a new value to it based on the result.&amp;nbsp; Again, I am pretty sure you can do this either via the data load editor or by creating a small reference file, but is there some way to define these things through set analysis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my big concern is, i come from a world where i might have a core set of 9-10 large tables all with millions if not billions of rows of information.&amp;nbsp; does it make sense to have to refresh multiple instances of those tables across multiple dashboard visuals in order to be able to make these types of things happen?&amp;nbsp; I'm hoping that i'm just still inexperienced at set analysis and haven't realized it's full potential.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; interested in the communities feedback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2016 00:07:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/advanced-set-analysis/m-p/1094362#M18347</guid>
      <dc:creator />
      <dc:date>2016-02-11T00:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: advanced set analysis?</title>
      <link>https://community.qlik.com/t5/App-Development/advanced-set-analysis/m-p/1094363#M18348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I might not have full understood your question, so bear with me if you think I am talking total nonsense but...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am just curious about why you think that we cannot accomplish scenario using Pivot Table. Seems like a good candidate for pivot table where you can add conditions in your expression's set analysis with patient number and sequence as your dimension and sequence is pivoted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And even the second scenario can be programmed on the front end (or partially script and partially UI based) using if statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2016 09:52:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/advanced-set-analysis/m-p/1094363#M18348</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-02-11T09:52:55Z</dc:date>
    </item>
  </channel>
</rss>

