JsonStatham
JsonStatham

Reputation: 10374

SSRS BIDS 2008 Expression for YEAR part of current system date

Does anyone know what the expression is to take the YEAR only from the current date in SSRS BIDS 2008. I need this as I have a table grouped on multiple years and I want to FILL the current year in green and leave the rest white.

I am going to use the following expresssion (minus the current year part)

=iif(Fields!Date_year.Value="_____","SeaGreen","White")

Can anyone help me with this?

Upvotes: 0

Views: 5743

Answers (3)

PhilC
PhilC

Reputation: 418

My solution:

=iif(Fields!Date_year.Value= Year(NOW) ,"SeaGreen","White")

Upvotes: 2

general exception
general exception

Reputation: 4342

I think he means like this...

Iif( Year(Fields!Date_year.Value) = Year(NOW), "SeaGreen", "White")

he wants the year bit dynamic.

If the Date_year bit equals the current year then show it in SeaGreen ????

Upvotes: 2

gonsalu
gonsalu

Reputation: 3194

If your field has a date datatype, you can use the Year() function, like so:

Iif( Year(Fields!Date_year.Value) = 2011, "SeaGreen", "White")

If the field has a string datatype, you can convert it to a date first, using the DateTime.Parse() function.

Reading material:

Upvotes: 1

Related Questions