<?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: Strange error: Invalid expression? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706176#M674569</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Ben.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Alessandro States, you cannot use an aggregation function without a group by statement. However, the solution is not to add a group by statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can fix this error by changing &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;TempAccountValue:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; left join (TempCalendar)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Load Distinct&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; AccountValue.AsOfDate&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Resident AccountValue;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;to&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;TempAccountValue:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Outer join (TempCalendar)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Load &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max(AccountValue.AsOfDate) as MaxAsOfDate&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Resident AccountValue;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can change your if to:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;f(Year(Today())=Year(Date) And Num(Month(Today()))=Month(MaxAsOfDate),1,&amp;nbsp; &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;If(Year(Today())&amp;gt;Year(Date) And Num(Month(Date))=12,1,0)) as ReportingPeriodFlag,&amp;nbsp; &lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;BR /&gt;SKG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Jul 2014 13:21:32 GMT</pubDate>
    <dc:creator>simenkg</dc:creator>
    <dc:date>2014-07-18T13:21:32Z</dc:date>
    <item>
      <title>Strange error: Invalid expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706173#M674566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Community,&lt;/P&gt;&lt;P&gt;While coding an if flag in my calendar script, I got an invalid expression error.&amp;nbsp; I know that the expression Num(Month(Today()))=Max(Month(AccountValue.AsOfDate)) must have something to do with it, because the other expression ((Num(Month(Date))=12) runs fine on its own in a text box.&amp;nbsp; The purpose of the if flag is to give the maximum date (the AccountValue.AsOfDate) that the company has so far tracked its accounts this year--the rough equivalent is the last month--and, for all years previous, give the end of year date in December.&amp;nbsp; However, even though the syntax isn't flagged, I'm getting this error.&amp;nbsp; Could someone explain it to me?&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------&lt;/P&gt;&lt;P&gt;Invalid expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MAPPING LOAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(CalendarExclusions.Date) as CalendarExclusions.Date, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CalendarExclusions.WorkingDayCounter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM C:\QlikView\Development\QVD\Historical Analysis\SalesQVDLoad\CalendarExclusions.qvd (qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set vDateSourceTable = 'LinkTable';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vToday = num(Today());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempCalendar:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load Distinct&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(Daystart(Key|Date),'M/DD/YYYY') AS Date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resident $(vDateSourceTable);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempAccountValue:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join (TempCalendar)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load Distinct&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AccountValue.AsOfDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resident AccountValue; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;BR /&gt;LOAD Distinct&lt;BR /&gt; Date(Daystart(Date),'M/DD/YYYY') AS Key|Date,&lt;BR /&gt; Date,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Num(Weekday(Date))&amp;lt;5,Applymap('HolidayMap',Num(Date), 1),0) as WorkingDayFlag, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Year(Date) AS Year,&lt;BR /&gt; Year(Date) - 1 AS LYear,&lt;BR /&gt; Month(Date) AS Month,&lt;BR /&gt; Num(Month(Date)) AS MonthNumber,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt; If(Year(Today())=Year(Date) And Num(Month(Today()))=Max(Month(AccountValue.AsOfDate)),1,&amp;nbsp; &lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt; If(Year(Today())&amp;gt;Year(Date) And Num(Month(Date))=12,1,0)) as ReportingPeriodFlag,&amp;nbsp; &lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt; IF(((Year(Date)&amp;lt;=Year(Today())) and (Year(Date)&amp;gt;'2007')),Year(Date),Null()) as FilteredYear,&lt;BR /&gt; Week(Date) as WeekNumber,&lt;BR /&gt; Text(Date(monthstart(Date), 'MMM-YYYY')) AS MonthYear,&lt;BR /&gt; IF(Num(Weekday(Date))&amp;lt;5,Applymap('HolidayMap',Num(Date), 1),Null()) * week(Date) as Week,&lt;/P&gt;&lt;P&gt; If(Month(Date)&amp;gt;0,'Q' &amp;amp; ceil(Month(Date) / 3)) AS Quarter,&lt;BR /&gt; If(Month(Date)&amp;gt;0,'Q' &amp;amp; ceil(Month(Date) / 3)) &amp;amp; '-' &amp;amp; Year(Date) AS QuarterYear,&lt;BR /&gt; Ceil(Day(Date)/7,1) as MonthWeekNumber&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; TempCalendar;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Drop&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Table&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; TempCalendar;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Drop&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Table&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; TempAccountValue;&lt;BR /&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 13:10:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706173#M674566</guid>
      <dc:creator />
      <dc:date>2014-07-18T13:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Strange error: Invalid expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706174#M674567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are using an aggregation function (Max) without a group by clause so the load cannot compute the max of the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to load without max (only to see if that is the problem), if you have not errors you need to compute max in another table and then left join your main table with the one with max&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 13:14:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706174#M674567</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-07-18T13:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Strange error: Invalid expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706175#M674568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Ben, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe this is because Max() is an aggregation function and would give you an invalid expression error in the absence of a group by clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i was you i would load that field separately and left join into the Calendar table.&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;R &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 13:19:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706175#M674568</guid>
      <dc:creator />
      <dc:date>2014-07-18T13:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Strange error: Invalid expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706176#M674569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Ben.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Alessandro States, you cannot use an aggregation function without a group by statement. However, the solution is not to add a group by statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can fix this error by changing &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;TempAccountValue:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; left join (TempCalendar)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Load Distinct&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; AccountValue.AsOfDate&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Resident AccountValue;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;to&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;TempAccountValue:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Outer join (TempCalendar)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Load &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max(AccountValue.AsOfDate) as MaxAsOfDate&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; Resident AccountValue;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can change your if to:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;f(Year(Today())=Year(Date) And Num(Month(Today()))=Month(MaxAsOfDate),1,&amp;nbsp; &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;If(Year(Today())&amp;gt;Year(Date) And Num(Month(Date))=12,1,0)) as ReportingPeriodFlag,&amp;nbsp; &lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;BR /&gt;SKG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 13:21:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706176#M674569</guid>
      <dc:creator>simenkg</dc:creator>
      <dc:date>2014-07-18T13:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Strange error: Invalid expression?</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706177#M674570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Simen and all,&lt;/P&gt;&lt;P&gt;Thanks! It's progressing past that point in the load. I really appreciate the quick response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 15:55:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-error-Invalid-expression/m-p/706177#M674570</guid>
      <dc:creator />
      <dc:date>2014-07-18T15:55:08Z</dc:date>
    </item>
  </channel>
</rss>

