<?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: set analysis date comparison in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435919#M162608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your problem is in the set syntaxis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to use a Key as the searched dimension.&lt;/P&gt;&lt;P&gt;Check the document in &lt;A href="https://community.qlik.com/docs/DOC-4951"&gt;Set Analysis: syntaxes, examples&lt;/A&gt;, page 14 in the PDF (thanks &lt;A href="https://community.qlik.com/qlik-users/134028"&gt;Fabrice Aunez&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;&lt;STRONG&gt;Using two fields&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;If we want to select a dimension through two fields, for example:&lt;/P&gt;
&lt;P&gt;- Billed client = Delivered Client&lt;/P&gt;
&lt;P&gt;- Ordering Date = Delivery Date&lt;/P&gt;
&lt;P&gt;- …&lt;/P&gt;
&lt;P&gt;The syntax is more or less the one seen in 4.6.2. section:&lt;/P&gt;
&lt;P&gt;Syntax: {&amp;lt;Dimension = {"=boolean condition"}&amp;gt;}&lt;/P&gt;
&lt;P&gt;The boolean condition will be created by comparing the two fields.&lt;/P&gt;
&lt;P&gt;Attention: the searched dimension cannot be also in the boolean condition. If needed, create an&lt;/P&gt;
&lt;P&gt;integer key with Autonumber().&lt;/P&gt;
&lt;P&gt;We want to get the sales that have been delivered the same day. We have two fields : DayDelivery and&lt;/P&gt;
&lt;P&gt;DayOrder&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;KeyAutoNumber = {"=(DayDelivery=DayOrder)" } &amp;gt;} Sales)&lt;/P&gt;
&lt;P&gt;And we can easily get the sales with a late delivery, for example 7 days or whatever stored into a variable:&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;KeyAutoNumber = {"=(DayDelivery &amp;lt; DayOrder -7)" } &amp;gt;} Sales)&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;KeyAutoNumber = {"=( DayDelivery &amp;lt; DayOrder -$(vDelay))" } &amp;gt;} Sales)&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 May 2014 09:53:16 GMT</pubDate>
    <dc:creator>ablaas</dc:creator>
    <dc:date>2014-05-15T09:53:16Z</dc:date>
    <item>
      <title>set analysis date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435912#M162601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;I'm having trouble comparing dates using set analysis:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to count the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Number of&amp;nbsp; patients where [Death_Date] is 7 days or less after [surgery_1_date]&lt;/P&gt;&lt;P&gt;2) Number of patients where&amp;nbsp; [Death_Date] is between 8 days post [surgery_1_date] and [surgery_2_date]&lt;/P&gt;&lt;P&gt;3) Number of patients where&amp;nbsp; [Death_Date] is after [discharge date] but before [surgery_2_date] ONLY WHERE [admit_type] ='1'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the best i have is:&lt;/P&gt;&lt;P&gt;=count({$&amp;lt;DEATH_DATE = {"&amp;lt;[surgery_1_date]"}&amp;gt;} PAT_ID) &lt;/P&gt;&lt;P&gt;but i can't figure out how to intergrate the more elaborate conditions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help!&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 15:42:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435912#M162601</guid>
      <dc:creator />
      <dc:date>2013-05-07T15:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435913#M162602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do the calculation in Script like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Floor([Death_Date] - [surgery_1_date]) &amp;lt;= 7, 1, 0) AS 7DaysOrLess,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Floor([Death_Date] - [surgery_2_date]) &amp;lt;= 8, 1, 0) AS 8DaysOrLess,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(([Death_Date] &amp;gt; [discharge date]) AND ([discharge date] &amp;lt; [surgery_2_date]), 1, 0) AS AfterDischarge&lt;/P&gt;&lt;P&gt;FROM DataSource;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now for &lt;/P&gt;&lt;P&gt;1) Sum(7DaysOrLess)&lt;/P&gt;&lt;P&gt;2) Sum(8DaysOrLess)&lt;/P&gt;&lt;P&gt;3) Sum({&amp;lt;[admit_type] ={'1'} &amp;gt;} AfterDischarge)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 16:26:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435913#M162602</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2013-05-07T16:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435914#M162603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for your help. i am wondering, though why we can't accomplish this in SET. For example, do you know what is wrong with this? It should work....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; =count({$&amp;lt;DEATH_DATE = {"&amp;lt;{$(=([SURG_DATE]+7))}"} &amp;gt;} PAT_MRN_ID) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that should be counting the PatID, where Death Date is &amp;lt; (surgery+7 days)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but its not working... don't know why.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 16:46:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435914#M162603</guid>
      <dc:creator />
      <dc:date>2013-05-07T16:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435915#M162604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;We can do this by using the Aggr() and If(), but it has performance issues, better calculating in script itself, so that we can avoid huge expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 16:49:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435915#M162604</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2013-05-07T16:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435916#M162605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, that is fair.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you mind showing an example of how this would be done using Aggr() and If()... ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 17:17:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435916#M162605</guid>
      <dc:creator />
      <dc:date>2013-05-07T17:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435917#M162606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum(Aggr(If(Floor([Death_Date] - [surgery_1_date]) &amp;lt;= 7, 1, 0), PatientDimensionName))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 May 2013 05:14:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435917#M162606</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2013-05-08T05:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435918#M162607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just found a document where there is a similar example, using set analysis:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Sum({&amp;lt;KeyAutoNumber = {"=(DayDelivery &amp;lt; DayOrder -7)" } &amp;gt;} Sales)&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can find it in: &lt;A href="https://community.qlik.com/docs/DOC-4951"&gt;Set Analysis: syntaxes, examples&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the PDF, page 14&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 09:50:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435918#M162607</guid>
      <dc:creator>ablaas</dc:creator>
      <dc:date>2014-05-15T09:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435919#M162608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your problem is in the set syntaxis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to use a Key as the searched dimension.&lt;/P&gt;&lt;P&gt;Check the document in &lt;A href="https://community.qlik.com/docs/DOC-4951"&gt;Set Analysis: syntaxes, examples&lt;/A&gt;, page 14 in the PDF (thanks &lt;A href="https://community.qlik.com/qlik-users/134028"&gt;Fabrice Aunez&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;&lt;STRONG&gt;Using two fields&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;If we want to select a dimension through two fields, for example:&lt;/P&gt;
&lt;P&gt;- Billed client = Delivered Client&lt;/P&gt;
&lt;P&gt;- Ordering Date = Delivery Date&lt;/P&gt;
&lt;P&gt;- …&lt;/P&gt;
&lt;P&gt;The syntax is more or less the one seen in 4.6.2. section:&lt;/P&gt;
&lt;P&gt;Syntax: {&amp;lt;Dimension = {"=boolean condition"}&amp;gt;}&lt;/P&gt;
&lt;P&gt;The boolean condition will be created by comparing the two fields.&lt;/P&gt;
&lt;P&gt;Attention: the searched dimension cannot be also in the boolean condition. If needed, create an&lt;/P&gt;
&lt;P&gt;integer key with Autonumber().&lt;/P&gt;
&lt;P&gt;We want to get the sales that have been delivered the same day. We have two fields : DayDelivery and&lt;/P&gt;
&lt;P&gt;DayOrder&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;KeyAutoNumber = {"=(DayDelivery=DayOrder)" } &amp;gt;} Sales)&lt;/P&gt;
&lt;P&gt;And we can easily get the sales with a late delivery, for example 7 days or whatever stored into a variable:&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;KeyAutoNumber = {"=(DayDelivery &amp;lt; DayOrder -7)" } &amp;gt;} Sales)&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;KeyAutoNumber = {"=( DayDelivery &amp;lt; DayOrder -$(vDelay))" } &amp;gt;} Sales)&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 09:53:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-date-comparison/m-p/435919#M162608</guid>
      <dc:creator>ablaas</dc:creator>
      <dc:date>2014-05-15T09:53:16Z</dc:date>
    </item>
  </channel>
</rss>

