<?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: How to write this logic in set-analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702496#M253502</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I must have misunderstood. Is there any way you can post a sample of the data structure?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Sep 2014 18:35:01 GMT</pubDate>
    <dc:creator>cspencer3</dc:creator>
    <dc:date>2014-09-15T18:35:01Z</dc:date>
    <item>
      <title>How to write this logic in set-analysis</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702492#M253498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need your help to write an expression using set-analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to calculate the Events based on date condition.. In my database i need to check the stats of event on every week start date..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is the query to calculate events for a single week start date.. i have a field weekstart date.. so the same logic i want to calculate for each weekstart date..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Count (Event)&lt;/P&gt;&lt;P&gt;where CODE = 'India'&lt;/P&gt;&lt;P&gt;AND WeekStart &amp;lt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&lt;/P&gt;&lt;P&gt;AND (Complete_Date &amp;gt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&lt;/P&gt;&lt;P&gt;&amp;nbsp; OR Cancel_Date &amp;gt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&lt;/P&gt;&lt;P&gt;&amp;nbsp; OR (Complete_Date IS NULL AND Cancel_Date IS NULL))&lt;/P&gt;&lt;P&gt; From Event_table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above query the difficult part to transform in to set analysis is the OR inside AND.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me to solve this logic..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached the sample data and qvw..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Aashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 17:30:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702492#M253498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-15T17:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to write this logic in set-analysis</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702493#M253499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any ideas ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 17:54:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702493#M253499</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-15T17:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to write this logic in set-analysis</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702494#M253500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you possibly create that logic using an IF statement in the load script which is used to Flag the record. Then in your set only count records that have that Flag set to True? I do this sometimes when i need and/or logic instead of putting it into the Set Analysis which can get complex pretty quickly. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 18:10:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702494#M253500</guid>
      <dc:creator>cspencer3</dc:creator>
      <dc:date>2014-09-15T18:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to write this logic in set-analysis</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702495#M253501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Charles, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But how I will get the comparison of various dates with week start date...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to calculate this expression for every week start date..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any kind of help is highly appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 18:25:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702495#M253501</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-15T18:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to write this logic in set-analysis</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702496#M253502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I must have misunderstood. Is there any way you can post a sample of the data structure?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 18:35:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702496#M253502</guid>
      <dc:creator>cspencer3</dc:creator>
      <dc:date>2014-09-15T18:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to write this logic in set-analysis</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702497#M253503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aashish,&lt;/P&gt;&lt;P&gt;I can't open the attached Event.qvw file since I am using personal edition.&lt;/P&gt;&lt;P&gt;So can you help me understand what this condition does when counting events ? &lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;AND WeekStart &amp;lt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&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;or perhaps based on the excel data, can you show the output that is expected e.g.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jiveImage" src="https://community.qlik.com/legacyfs/online/66801_pastedImage_2.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 19:43:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702497#M253503</guid>
      <dc:creator />
      <dc:date>2014-09-15T19:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to write this logic in set-analysis</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702498#M253504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jain,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WeekStart Date i need to put as dimension and the below query gives the count of all events having weekstart date less than or equal to weekstart date and complete_date &amp;gt;= weekstart date OR Cancel_Date &amp;gt;= weekstartdate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Select Count (Event)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;where CODE = 'India'&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;AND WeekStart &amp;lt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;AND (Complete_Date &amp;gt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; OR Cancel_Date &amp;gt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; OR (Complete_Date IS NULL AND Cancel_Date IS NULL))&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;From Event_table;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hope this clears the logic..&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Aashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 02:22:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702498#M253504</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-09-16T02:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to write this logic in set-analysis</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702499#M253505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aashish,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I think I have a Solution without using set analysis, albeit tricky one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First lets break down the conditions;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;AND WeekStart &amp;lt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;STRONG&gt;WeekStart&lt;/STRONG&gt; is by same name in the application,&lt;/P&gt;&lt;P&gt;TO_DATE('14-07-2014', 'DD-MM-YYYY') is named &lt;STRONG&gt;WeekStart2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This particular condition is managed during Load of the table.&lt;/P&gt;&lt;P&gt;Since we want to know that for a given Week, how many weeks are smaller than it (to consider those events), I had to create another field &lt;STRONG&gt;WeekStart2&lt;/STRONG&gt; with Cartesian product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EventData:&lt;/P&gt;&lt;P&gt;LOAD Event,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WeekStart,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Complete Date],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Cancel Date]&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;EventData.xlsx&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet3);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outer Join(EventData)&lt;/P&gt;&lt;P&gt;LOAD distinct WeekStart as WeekStart2&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;EventData.xlsx&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet3)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, resident load and apply the first condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EventData1:&lt;/P&gt;&lt;P&gt;Load Event,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WeekStart,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(WeekStart&amp;lt;=WeekStart2,WeekStart2) as WeekStart2,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Complete Date],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Cancel Date]&lt;/P&gt;&lt;P&gt;Resident EventData;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally remove rows that has WeekStart2 empty as condition is not satisfied&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EventData2:&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;Resident EventData1&lt;/P&gt;&lt;P&gt;where WeekStart2 &amp;lt;&amp;gt; Null();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the rest of the conditions;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;AND (Complete_Date &amp;gt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; OR Cancel_Date &amp;gt;= TO_DATE('14-07-2014', 'DD-MM-YYYY')&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; OR (Complete_Date IS NULL AND Cancel_Date IS NULL))&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This is handled in fairly simple way in chart expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count(if(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ([Complete Date] &amp;gt;= WeekStart2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR [Cancel Date] &amp;gt;= WeekStart2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR (IsNull([Complete Date]) and IsNull([Cancel Date]))), Event&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the result :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="66910" alt="" class="jiveImage" src="https://community.qlik.com/legacyfs/online/66910_pastedImage_5.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect there is a down side that it may not work if volume of data is high.&lt;/P&gt;&lt;P&gt;Do try this out and let me know if it works for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kalpesh Jain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 20:09:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-this-logic-in-set-analysis/m-p/702499#M253505</guid>
      <dc:creator />
      <dc:date>2014-09-16T20:09:22Z</dc:date>
    </item>
  </channel>
</rss>

