<?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: Running Selection on invoice date based upon dimension in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Running-Selection-on-invoice-date-based-upon-dimension/m-p/333045#M577535</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;i have the same problem. Nobody can offer an approch?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Jul 2012 16:47:24 GMT</pubDate>
    <dc:creator>azimabadi</dc:creator>
    <dc:date>2012-07-02T16:47:24Z</dc:date>
    <item>
      <title>Running Selection on invoice date based upon dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Running-Selection-on-invoice-date-based-upon-dimension/m-p/333044#M577534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;I am stuck in an expression where I need to calculate the sum of on-demand quantity in a table with InvoiceAltYearMonth(Year-Month) as a dimension. For every year month, I need to look at a period which falls between the last day of that year month and a date 'OnDemandCode' weeks from it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;Chart Dimension: InvoiceAltYearMonth(Year-Month)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;STRONG style="font-size: 13px;"&gt;Start Date (based upon 'Go back X weeks' selection) (works fine): &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 13px;"&gt;=Date(Max({&amp;lt;InvoiceAltLastDayOfMonth={1}&amp;gt;} InvoiceDate)-7*OnDemandCode, DateFormat)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;STRONG&gt;Last Day of Every month (works fine):&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 13px;"&gt;=Max({&amp;lt;InvoiceAltLastDayOfMonth={1}&amp;gt;} InvoiceDate)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the attached file, you can see that the start dates and end dates are found accurately based upon the InvoiceAltYearMonth dimension. However, I am unable to calculate the sum of on demand quantity between Start Date (based upon 'Go back X weeks' selection) and Last Day of Every Month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PS: The start date is dynamic and is based upon the selection. Therefore, it's not necessary that the start date will always fall within the month in the dimension.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried two approaches:&lt;/P&gt;&lt;P&gt;1. Create variables and write expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vStartDate:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =Date(Max({&amp;lt;InvoiceAltLastDayOfMonth={1}&amp;gt;} InvoiceDate)-7*OnDemandCode, DateFormat)&lt;/P&gt;&lt;P&gt;vEndDate:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =Max({&amp;lt;InvoiceAltLastDayOfMonth={1}&amp;gt;} InvoiceDate)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Final Expression Approach 1&lt;/STRONG&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Sum({&amp;lt;InvoiceDate={"&amp;gt;=$(#vStartDate)&amp;lt;=$(#vEndDate)"}&amp;gt;} OnDemandQuantity))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Through this approach, the expression is calculated accurately only between 2/18/2012 and 2/25/2012. This happens because the variables in my set analysis are calculated only once, and not for every dimension which I actually expect to happen !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Write an expression by explicitly defining the start date and end date in the set analysis: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Final Expression Approach 2&lt;/STRONG&gt;: (Sum({&amp;lt;InvoiceDate={"&amp;gt;=$(#=Date(Max({&amp;lt;InvoiceAltLastDayOfMonth={1}&amp;gt;} InvoiceDate)-7*OnDemandCode, DateFormat))&amp;lt;=$(#=Max({&amp;lt;InvoiceAltLastDayOfMonth={1}&amp;gt;} InvoiceDate))"}&amp;gt;} OnDemandQuantity))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This approach gives all zeros.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;Can anyone please help me in finding a solution to this problem ? The qvw and xlsx files are attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 20:11:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Running-Selection-on-invoice-date-based-upon-dimension/m-p/333044#M577534</guid>
      <dc:creator />
      <dc:date>2012-04-02T20:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Running Selection on invoice date based upon dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Running-Selection-on-invoice-date-based-upon-dimension/m-p/333045#M577535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;i have the same problem. Nobody can offer an approch?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jul 2012 16:47:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Running-Selection-on-invoice-date-based-upon-dimension/m-p/333045#M577535</guid>
      <dc:creator>azimabadi</dc:creator>
      <dc:date>2012-07-02T16:47:24Z</dc:date>
    </item>
  </channel>
</rss>

