<?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: Date Formats in Set Analysis Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076178#M358998</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Max function will return the number values so you need to convert the number to your date format in SET analysis. For easy purpose create a variable that holds the Max date value with format and use the variable in SET analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vMaxDate7 = Date(Max(ReportDate)-7,'YYYY-MM-DD') &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need apply Metric Name filter on to date calculation,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;vMaxDate7 = Date(Max({&amp;lt;MetricName={"MyMetric"}&amp;gt;}ReportDate)-7,'YYYY-MM-DD') &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;and use below expression:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Sum({&amp;lt;MetricName={"MyMetric"},ReportDate={"&amp;gt;=$(vMaxDate7)"}&amp;gt;} Measure)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Feb 2016 02:50:37 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-02-09T02:50:37Z</dc:date>
    <item>
      <title>Date Formats in Set Analysis Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076176#M358996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a date field that I'm working with using set analysis, but I'm having a few issues. The date is formatted in the data as "YYYY-MM-DD" and is read in the field ReportDate. My set expression is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({$&amp;lt;MetricName={"MyMetric"}, ReportDate={"&amp;gt;=Max(ReportDate)-7"}&amp;gt;} Measure)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This doesn't work because subtracting 7 from the Max(ReportDate) turns the ReportDate into a numerical value. I've also tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({$&amp;lt;MetricName={"MyMetric"}, ReportDate={"&amp;gt;=Date(Max(ReportDate)-7, 'YYYY-MM-DD')"}&amp;gt;} Measure)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({$&amp;lt;MetricName={"MyMetric"}, ReportDate={"&amp;gt;=$(Date(Max(ReportDate)-7, 'YYYY-MM-DD'))"}&amp;gt;} Measure)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({$&amp;lt;MetricName={"MyMetric"}, ReportDate={"&amp;gt;=$(=Date(Max(ReportDate)-7, 'YYYY-MM-DD'))"}&amp;gt;} Measure)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but none of these expressions evaluate correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I doing something obviously wrong here? Thanks so much for the review!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Feb 2016 22:21:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076176#M358996</guid>
      <dc:creator />
      <dc:date>2016-02-08T22:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Date Formats in Set Analysis Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076177#M358997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({$&amp;lt;MetricName={"MyMetric"}, ReportDate={"&amp;gt;=$(=Date(Max(ReportDate)-7, 'YYYY-MM-DD'))"}&amp;gt;} Measure)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you need to use the filter also in the Max() function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({$&amp;lt;MetricName={"MyMetric"}, ReportDate={"&amp;gt;=$(=Date(Max({&amp;lt;MetricName = {'MyMetric'}&amp;gt;} ReportDate)-7, 'YYYY-MM-DD'))"}&amp;gt;} Measure)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Feb 2016 22:52:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076177#M358997</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-02-08T22:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Date Formats in Set Analysis Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076178#M358998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Max function will return the number values so you need to convert the number to your date format in SET analysis. For easy purpose create a variable that holds the Max date value with format and use the variable in SET analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vMaxDate7 = Date(Max(ReportDate)-7,'YYYY-MM-DD') &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need apply Metric Name filter on to date calculation,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;vMaxDate7 = Date(Max({&amp;lt;MetricName={"MyMetric"}&amp;gt;}ReportDate)-7,'YYYY-MM-DD') &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;and use below expression:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Sum({&amp;lt;MetricName={"MyMetric"},ReportDate={"&amp;gt;=$(vMaxDate7)"}&amp;gt;} Measure)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2016 02:50:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076178#M358998</guid>
      <dc:creator />
      <dc:date>2016-02-09T02:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Date Formats in Set Analysis Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076179#M358999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Creating variables seemed to work! Not sure why it wouldn't work when coded directly in the expression, but I'm happy either way &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2016 16:51:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076179#M358999</guid>
      <dc:creator />
      <dc:date>2016-02-09T16:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Date Formats in Set Analysis Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076180#M359000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It should also work without the variable (though variables allow reuse, so it's not a bad idea).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess you just ran into some quoting troubles, note that I changed to single quotes for MetricName literal to prevent QV from misinterpreting an opening double quote as ending one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2016 16:59:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Formats-in-Set-Analysis-Expression/m-p/1076180#M359000</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-02-09T16:59:05Z</dc:date>
    </item>
  </channel>
</rss>

