SSRS - Conditional row background color - Alt rows

I have a report - there are a series of numbers listed (e.g. below) - what I need to do - is to set a row background color for every other number set - so all 1's will have a background color green, same with 3's, etc. - so need to conditionally alternate row color backgrounds - in XLS I can do it with =MOD($A1,2)=1 but need to so it in SSRS

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Need something like this in your detail row background properties
=IIF(RowNumber(Nothing) Mod 2 = 1, "White", "Silver")
You will need to change this to fit your row count
ValentinoVBI ConsultantCommented:
To add some more info on the previous reply by planocz: to select the "detail row", you need to click the grey box on the left of the detail row - that's the one with the three horizontal lines above each other.  These grey selectors only appear when the table is selected.

Now that the detail row is selected, in the Properties window, locate the BackgroundColor property.  Select it, click the dropdown, and choose "Expression".

The attached expression assumes that your number field is called ProductID.

Also note that this will only result in alternating colors for your numeric groups if they are increasing by one at a time, but I think you won't have an issue with that in your situation - you would have had the same issue in Excel.


=IIF(Fields!ProductID.Value Mod 2 = 1, "Green", "Blue")

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hi tbaseflug,
did the coments help you?
Do you need more help?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.