<?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 Dimension filter in Nested Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Dimension-filter-in-Nested-Set-Analysis/m-p/1327409#M410504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear fellow Qlikview users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working with a database with data from several hospitals (units) and i'm trying to build a pivot table to show the invoiced amount that belongs to the new patients.&lt;/P&gt;&lt;P&gt;In my data model, I have a flag (NewUnitClient) that holds 1 in the first time the client has an activity on that unit and 0 in all other times.&lt;/P&gt;&lt;P&gt;For that reason, i had to put the &amp;lt;NewUnitClient={1}&amp;gt; in a nested set analysis to return the total invoiced amount made by all the patients that were marked as new, otherwise i would only return the sum of invoiced amount of the first appointments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; {$&amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Patient_ID={"=count({$&amp;lt;NewUnitClient={1}&amp;gt;} DISTINCT Patient_ID)&amp;gt;0"}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt;}&lt;/P&gt;&lt;P&gt;#Invoiced)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression works fine when i'm trying to return the total amount considering all the units or if i only select one of them each time.&lt;/P&gt;&lt;P&gt;However, when i build a pivot table with this expression and the units as dimensions, i'm getting wrong values. &lt;/P&gt;&lt;P&gt;I've noticed that the dimension (units) doesn't filter my nested set analysis. So, &lt;SPAN style="text-decoration: underline;"&gt;the values i obtain in the pivot table are the sum of invoiced amount (for each unit) of all my new clients&lt;/SPAN&gt;. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; {$&amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Unit={'CentralHospital'},&lt;/P&gt;&lt;P&gt;&amp;nbsp; Patient_ID={"=count({$&amp;lt;NewUnitClient={1}&amp;gt;} DISTINCT Patient_ID)&amp;gt;0"}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt;}&lt;/P&gt;&lt;P&gt;#Invoiced)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But&lt;SPAN style="text-decoration: underline;"&gt; what i really want is the sum of invoiced amount (for each unit) of the new clients of that unit&lt;/SPAN&gt;. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; {$&amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Unit={'CentralHospital'},&lt;/P&gt;&lt;P&gt;&amp;nbsp; Patient_ID={"=count({$&amp;lt;NewUnitClient={1},Unit={'CentralHospital'}&amp;gt;} DISTINCT Patient_ID)&amp;gt;0"}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt;}&lt;/P&gt;&lt;P&gt;#Invoiced)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone has an idea of ​​how I could make this work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Jun 2017 18:22:44 GMT</pubDate>
    <dc:creator>nmsoares</dc:creator>
    <dc:date>2017-06-20T18:22:44Z</dc:date>
    <item>
      <title>Dimension filter in Nested Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Dimension-filter-in-Nested-Set-Analysis/m-p/1327409#M410504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear fellow Qlikview users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working with a database with data from several hospitals (units) and i'm trying to build a pivot table to show the invoiced amount that belongs to the new patients.&lt;/P&gt;&lt;P&gt;In my data model, I have a flag (NewUnitClient) that holds 1 in the first time the client has an activity on that unit and 0 in all other times.&lt;/P&gt;&lt;P&gt;For that reason, i had to put the &amp;lt;NewUnitClient={1}&amp;gt; in a nested set analysis to return the total invoiced amount made by all the patients that were marked as new, otherwise i would only return the sum of invoiced amount of the first appointments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; {$&amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Patient_ID={"=count({$&amp;lt;NewUnitClient={1}&amp;gt;} DISTINCT Patient_ID)&amp;gt;0"}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt;}&lt;/P&gt;&lt;P&gt;#Invoiced)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression works fine when i'm trying to return the total amount considering all the units or if i only select one of them each time.&lt;/P&gt;&lt;P&gt;However, when i build a pivot table with this expression and the units as dimensions, i'm getting wrong values. &lt;/P&gt;&lt;P&gt;I've noticed that the dimension (units) doesn't filter my nested set analysis. So, &lt;SPAN style="text-decoration: underline;"&gt;the values i obtain in the pivot table are the sum of invoiced amount (for each unit) of all my new clients&lt;/SPAN&gt;. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; {$&amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Unit={'CentralHospital'},&lt;/P&gt;&lt;P&gt;&amp;nbsp; Patient_ID={"=count({$&amp;lt;NewUnitClient={1}&amp;gt;} DISTINCT Patient_ID)&amp;gt;0"}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt;}&lt;/P&gt;&lt;P&gt;#Invoiced)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But&lt;SPAN style="text-decoration: underline;"&gt; what i really want is the sum of invoiced amount (for each unit) of the new clients of that unit&lt;/SPAN&gt;. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; {$&amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Unit={'CentralHospital'},&lt;/P&gt;&lt;P&gt;&amp;nbsp; Patient_ID={"=count({$&amp;lt;NewUnitClient={1},Unit={'CentralHospital'}&amp;gt;} DISTINCT Patient_ID)&amp;gt;0"}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt;}&lt;/P&gt;&lt;P&gt;#Invoiced)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone has an idea of ​​how I could make this work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 18:22:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dimension-filter-in-Nested-Set-Analysis/m-p/1327409#M410504</guid>
      <dc:creator>nmsoares</dc:creator>
      <dc:date>2017-06-20T18:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dimension filter in Nested Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Dimension-filter-in-Nested-Set-Analysis/m-p/1327410#M410505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nuno, Set analysis is calculated before the rows and columns so all the dimensions applies the same set analysis , you can try with:&lt;/P&gt;&lt;P&gt;Sum(Aggr(If(Sum(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;NewUnitClient&lt;/SPAN&gt;), Sum(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;#Invoiced&lt;/SPAN&gt;)), &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Patient_ID&lt;/SPAN&gt;, Unit))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe there is a better solutions for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 20:43:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dimension-filter-in-Nested-Set-Analysis/m-p/1327410#M410505</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2017-06-20T20:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dimension filter in Nested Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Dimension-filter-in-Nested-Set-Analysis/m-p/1327411#M410506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ruben,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the tip. It works perfectly!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 16:31:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dimension-filter-in-Nested-Set-Analysis/m-p/1327411#M410506</guid>
      <dc:creator>nmsoares</dc:creator>
      <dc:date>2017-06-21T16:31:11Z</dc:date>
    </item>
  </channel>
</rss>

