<?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 Need Help on Set Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290500#M107847</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Stefa,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First thanks for your time explain about set analysis. the expression which is working fine...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chriss&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Feb 2012 07:25:35 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-02-20T07:25:35Z</dc:date>
    <item>
      <title>Need Help on Set Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290496#M107843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on Customer Selection I can find the last week number of invoices and value of in rupees.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am generating the report on weekly basis I have a problem in suppose when the customer they don't invoices and value of rupee for last 4 weeks means its taking previous 4th week maximum of value and number of invoices, but I need to display last week as zero number of invoices and value of invoices.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help me. below the expression is ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;= sum({&amp;lt;WEEK = {'$(=max(WEEK-1))'}&amp;gt;} NB_INVOICE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;= sum({&amp;lt;WEEK = {'$(=max(WEEK-1))'}&amp;gt;} TOTAL_RUPEE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chriss&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 13:24:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290496#M107843</guid>
      <dc:creator />
      <dc:date>2011-12-09T13:24:09Z</dc:date>
    </item>
    <item>
      <title>Need Help on Set Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290497#M107844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that you don't use a master calendar which holds all WEEKs regardless if you got NB_INVOICE and TOTAL_RUPEE values linked to them?&lt;/P&gt;&lt;P&gt;So you have a field WEEK with gaps where you don't have data for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this is the best solution, but maybe you could replace the max(WEEK-1) with an expression that creates a WEEK value based on today() or something appropriate, maybe like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;WEEK = {'$(=week(today())-1)'} &amp;gt;} NB_INVOICE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This expression (week(today()) must result in the same format as your WEEK field (I assumed integer).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, how do you handle year change if using a WEEK number?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2011 14:03:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290497#M107844</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-12-09T14:03:04Z</dc:date>
    </item>
    <item>
      <title>Need Help on Set Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290498#M107845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Dear Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what you assumed is correct,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so I tried =Sum({&amp;lt;WEEK={"$(=max({&amp;lt;YEAR={"$(=max(YEAR))"}&amp;gt;}WEEK))-1"}&amp;gt;}NB_INVOICE) this expression is&amp;nbsp; working fine.&lt;/P&gt;&lt;P&gt;Now I am facing the same old problem of if there is no data for the last 2 or three weeks it takes the value of 2 weeks before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like we are in 7th week there is no data for 5 and 6 it should display as 0 but its taking the 3rd week data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help me on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chriss&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 11:02:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290498#M107845</guid>
      <dc:creator />
      <dc:date>2012-02-17T11:02:54Z</dc:date>
    </item>
    <item>
      <title>Need Help on Set Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290499#M107846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your example, we are in 7th week. Do you have data for the 7th week? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If yes, your set expression&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;=Sum({&amp;lt;WEEK={"$(=max({&amp;lt;YEAR={"$(=max(YEAR))"}&amp;gt;}WEEK))-1"}&amp;gt;}NB_INVOICE)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should evaluate to&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;--&amp;gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #636363; font-size: 12px; background-color: #eef4f9; font-family: Arial;"&gt;=Sum({&amp;lt;WEEK={"$(7-1"}&amp;gt;}NB_INVOICE)&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-size: 12px; background-color: #eef4f9; font-family: Arial;"&gt;--&amp;gt;&amp;nbsp; &lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;=Sum({&amp;lt;WEEK={"6"}&amp;gt;}NB_INVOICE)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and if you don't have data for the Week 6, the result should be zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't have data for the 7th week, no data for week 5 and 6 too, your set expression will evaluate to&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;--&amp;gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #636363; font-size: 12px; background-color: #eef4f9; font-family: Arial;"&gt;=Sum({&amp;lt;WEEK={"$(4-1"}&amp;gt;}NB_INVOICE)&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;--&amp;gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #636363; font-size: 12px; background-color: #eef4f9; font-family: Arial;"&gt;=Sum({&amp;lt;WEEK={"3"}&amp;gt;}NB_INVOICE)&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So no wonder that you get the data for Week 3 returned.&lt;/P&gt;&lt;P&gt;max(WEEK) will take the max possible data into account, i.e. it is dependent on the data you have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[BTW, I would also set the YEAR to the max(Year) to limit the NB_INVOICE records to this year, see below]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's why I suggested to use &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #ffffff;"&gt; {'$(=week(today())-1)'} &amp;gt;} &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;instead, that should evaluate to {'6'} and should return zero in your set expression.&lt;/P&gt;&lt;P&gt;If you need to regard the YEAR also (what your probably need to do), use&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #ffffff;"&gt;=sum({&amp;lt;WEEK = {'$(=week(today())-1)'}, YEAR={'$(=year(today()))'} &amp;gt;} NB_INVOICE)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using the dollar sign expressions =$(...)&amp;nbsp; each in a e.g. text box and look what is returned. Then select this number in a WEEK list box and look what is returned from a =sum( NB_INVOICE) expression.&lt;/P&gt;&lt;P&gt;Also creating a table box with WEEK, YEAR and NB_INVOICE could give you some insight in your data and how it is depending on selections (and set expression is just like a per-expression-selection).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 15:07:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290499#M107846</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-17T15:07:28Z</dc:date>
    </item>
    <item>
      <title>Need Help on Set Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290500#M107847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Stefa,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First thanks for your time explain about set analysis. the expression which is working fine...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chriss&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2012 07:25:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-Help-on-Set-Expression/m-p/290500#M107847</guid>
      <dc:creator />
      <dc:date>2012-02-20T07:25:35Z</dc:date>
    </item>
  </channel>
</rss>

