<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The DatePart() Function in SSRS</title>
	<atom:link href="http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/feed/" rel="self" type="application/rss+xml" />
	<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/</link>
	<description>A blog about Business Intelligence and other personal interests</description>
	<lastBuildDate>Fri, 13 Jan 2012 08:11:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Margaret Norkett</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1260</link>
		<dc:creator>Margaret Norkett</dc:creator>
		<pubDate>Fri, 13 May 2011 13:09:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1260</guid>
		<description>Thanks Luke -- I had it figured out by the time you got this posted and my report looks great!</description>
		<content:encoded><![CDATA[<p>Thanks Luke &#8212; I had it figured out by the time you got this posted and my report looks great!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Hayler</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1258</link>
		<dc:creator>Luke Hayler</dc:creator>
		<pubDate>Thu, 12 May 2011 22:12:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1258</guid>
		<description>Hi Margaret,

Whoops. It seems I was in a bit of a rush yesterday. I have updated the previous comment with the correct expression. 
I also noticed that I completely forgot to add the &quot;Today()&quot; bit to the SWITCH expression! Both expressions now work as expected.</description>
		<content:encoded><![CDATA[<p>Hi Margaret,</p>
<p>Whoops. It seems I was in a bit of a rush yesterday. I have updated the previous comment with the correct expression.<br />
I also noticed that I completely forgot to add the &#8220;Today()&#8221; bit to the SWITCH expression! Both expressions now work as expected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Margaret Norkett</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1257</link>
		<dc:creator>Margaret Norkett</dc:creator>
		<pubDate>Thu, 12 May 2011 11:29:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1257</guid>
		<description>I&#039;m still getting an error about an expected &quot;)&quot; in the expression and although you didn&#039;t code it that way, I&#039;m using Today()) after the date interval statement as I need it to evaluate what month or quarter it is when the report runs so that it pulls back the relevant data for the corresponding quarter. This statement will also be used in the fields in the matrix to get the correct sums.</description>
		<content:encoded><![CDATA[<p>I&#8217;m still getting an error about an expected &#8220;)&#8221; in the expression and although you didn&#8217;t code it that way, I&#8217;m using Today()) after the date interval statement as I need it to evaluate what month or quarter it is when the report runs so that it pulls back the relevant data for the corresponding quarter. This statement will also be used in the fields in the matrix to get the correct sums.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Hayler</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1256</link>
		<dc:creator>Luke Hayler</dc:creator>
		<pubDate>Wed, 11 May 2011 22:34:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1256</guid>
		<description>Hi Margaret,

Firstly, I noticed that your expression was missing a few brackets - after &quot;Today()&quot;, and your IIF() statements, like birds eggs, needed to be nested:
=IIF(DatePart(DateInterval.Month, Today(),0,0) &lt; 4, “4th Q PMs by Area, Type”,
IIF (DatePart(DateInterval.Month, Today(),0,0) &lt; 7, “1st Q PMs by Area, Type”,
IIF (DatePart(DateInterval.Month, Today(),0,0) &lt; 10, “2nd Q PMs by Area, Type”, “3rd Q PMs by Area, Type”)))

Secondly, this scenario would be better suited to using a SWITCH() function:

=SWITCH( DatePart(DateInterval.Month, Today()) &lt; 4,  “4th Q PMs by Area, Type”, DatePart(DateInterval.Month, Today()) &lt; 7,  “1st Q PMs by Area, Type”, DatePart(DateInterval.Month, Today()) &lt; 10,  “2nd Q PMs by Area, Type”, DatePart(DateInterval.Month, Today()) &lt; 13,  “3rd Q PMs by Area, Type”)

The SWITCH() Function evaluates each of the expressions in sequence and uses the first one that evaluates to &#039;TRUE&#039;.

Happy coding!</description>
		<content:encoded><![CDATA[<p>Hi Margaret,</p>
<p>Firstly, I noticed that your expression was missing a few brackets &#8211; after &#8220;Today()&#8221;, and your IIF() statements, like birds eggs, needed to be nested:<br />
=IIF(DatePart(DateInterval.Month, Today(),0,0) < 4, “4th Q PMs by Area, Type”,<br />
IIF (DatePart(DateInterval.Month, Today(),0,0) < 7, “1st Q PMs by Area, Type”,<br />
IIF (DatePart(DateInterval.Month, Today(),0,0) < 10, “2nd Q PMs by Area, Type”, “3rd Q PMs by Area, Type”)))</p>
<p>Secondly, this scenario would be better suited to using a SWITCH() function:</p>
<p>=SWITCH( DatePart(DateInterval.Month, Today()) < 4,  “4th Q PMs by Area, Type”, DatePart(DateInterval.Month, Today()) < 7,  “1st Q PMs by Area, Type”, DatePart(DateInterval.Month, Today()) < 10,  “2nd Q PMs by Area, Type”, DatePart(DateInterval.Month, Today()) < 13,  “3rd Q PMs by Area, Type”)</p>
<p>The SWITCH() Function evaluates each of the expressions in sequence and uses the first one that evaluates to &#8216;TRUE&#8217;.</p>
<p>Happy coding!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Margaret Norkett</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1255</link>
		<dc:creator>Margaret Norkett</dc:creator>
		<pubDate>Wed, 11 May 2011 15:20:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1255</guid>
		<description>I&#039;m trying to return a specific label based on what month a report is run in. I&#039;ve put the following in the expression box, however I&#039;m getting an &quot;Overload resolution failed because no accessible &#039;DatePart&#039; can be called without a narrowing conversion&quot; error

IIF(DatePart(DateInterval.Month, Today() between 1 and 3, &quot;4th Q PMs by Area, Type&quot;)
IIF (DatePart(DateInterval.Month, Today() between 4 and 6, &quot;1st Q PMs by Area, Type&quot;)
IIF (DatePart(DateInterval.Month, Today() between 7 and 9, &quot;2nd Q PMs by Area, Type&quot;)
IIF (DatePart(DateInterval.Month, Today() between 10 and 12, &quot;3rd Q PMs by Area, Type&quot;)

can you help direct me in correcting the expression in order to produce the label I need?

Thanks!</description>
		<content:encoded><![CDATA[<p>I&#8217;m trying to return a specific label based on what month a report is run in. I&#8217;ve put the following in the expression box, however I&#8217;m getting an &#8220;Overload resolution failed because no accessible &#8216;DatePart&#8217; can be called without a narrowing conversion&#8221; error</p>
<p>IIF(DatePart(DateInterval.Month, Today() between 1 and 3, &#8220;4th Q PMs by Area, Type&#8221;)<br />
IIF (DatePart(DateInterval.Month, Today() between 4 and 6, &#8220;1st Q PMs by Area, Type&#8221;)<br />
IIF (DatePart(DateInterval.Month, Today() between 7 and 9, &#8220;2nd Q PMs by Area, Type&#8221;)<br />
IIF (DatePart(DateInterval.Month, Today() between 10 and 12, &#8220;3rd Q PMs by Area, Type&#8221;)</p>
<p>can you help direct me in correcting the expression in order to produce the label I need?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1236</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Fri, 06 May 2011 13:21:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-1236</guid>
		<description>Thank you, Very Helpful!</description>
		<content:encoded><![CDATA[<p>Thank you, Very Helpful!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Hayler</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-371</link>
		<dc:creator>Luke Hayler</dc:creator>
		<pubDate>Wed, 06 Apr 2011 23:24:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-371</guid>
		<description>Have you tried =Format(Fields!DateField.value, &quot;d-MMM-yyyy&quot;)?

have a look at &lt;a&gt;http://thavash.wordpress.com/2007/10/02/date-formatting-in-reporting-services-list-of-format-codes/&lt;/a&gt; for more on Date formatting codes.</description>
		<content:encoded><![CDATA[<p>Have you tried =Format(Fields!DateField.value, &#8220;d-MMM-yyyy&#8221;)?</p>
<p>have a look at <a>http://thavash.wordpress.com/2007/10/02/date-formatting-in-reporting-services-list-of-format-codes/</a> for more on Date formatting codes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: subhash</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-318</link>
		<dc:creator>subhash</dc:creator>
		<pubDate>Tue, 05 Apr 2011 12:55:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-318</guid>
		<description>i need to default a date parameter to this format
05-apr-2011(ie for today’s date)
can u please tell me how to do it</description>
		<content:encoded><![CDATA[<p>i need to default a date parameter to this format<br />
05-apr-2011(ie for today’s date)<br />
can u please tell me how to do it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Hayler</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-155</link>
		<dc:creator>Luke Hayler</dc:creator>
		<pubDate>Tue, 18 Jan 2011 01:59:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-155</guid>
		<description>Hi Carole,

Could you send through the expression that you are using?</description>
		<content:encoded><![CDATA[<p>Hi Carole,</p>
<p>Could you send through the expression that you are using?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carole wilson</title>
		<link>http://lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-154</link>
		<dc:creator>carole wilson</dc:creator>
		<pubDate>Fri, 14 Jan 2011 18:47:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.lukehayler.com/2009/11/the-datepart-function-in-ssrs/#comment-154</guid>
		<description>I have six rooms which have classes scheduled weekly.  I would like to see what the classes are by week. Show the class name, time, and instructor. The classes run over a range of dates.  I would like to test if the current week falls within the range.  The range could be 12/15/2010 to 3/15/2011.   I cannot seem to get the DatePart function &quot;ww&quot; to work. Probably because I don&#039;t understand it.  I would appreciate all suggestions.</description>
		<content:encoded><![CDATA[<p>I have six rooms which have classes scheduled weekly.  I would like to see what the classes are by week. Show the class name, time, and instructor. The classes run over a range of dates.  I would like to test if the current week falls within the range.  The range could be 12/15/2010 to 3/15/2011.   I cannot seem to get the DatePart function &#8220;ww&#8221; to work. Probably because I don&#8217;t understand it.  I would appreciate all suggestions.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

