Loudrain
Loudrain

Reputation: 3

Using IIF and DATEPART in SSRS to highlight the first of the month in date column

I have a date column that shows the days on each month. I need to highlight the first date of the month for each month. Example 07/01/2021 would be highlighted, 08/01/2021 would be highlighted; all other dates in the month would not. This is the code I am trying:

=iif(DatePart(DateInterval.Day, Fields!Date.Value, 1, "Yellow","Transparent"))

but it is not working. Any help would be appreciated.

Upvotes: 0

Views: 346

Answers (1)

Hannover Fist
Hannover Fist

Reputation: 10870

Your expression is incorrect. The Datepart should be compared to 1 and then IIF will use either the 2nd (true) and 3rd (false) argument.

=IIF(DatePart(DateInterval.Day, Fields!Date.Value) = 1, "Yellow", NOTHING)

Also, I think it's a old bug where "Transparent" is not a valid color even though that's what the GUI gives the user when clicking on NO COLOR. Either use "White" or NOTHING (the SSRS null value)

enter image description here

Upvotes: 0

Related Questions