How to color format column bar chart with 4 different colors
I have a column bar chart which displays values for each month. As per the requirement, January column must be blue, February must be orange, March must be green, April must be pink. These 4 colors would repeat for the remaining months.
September 8th, 2015 2:26pm

Hi,

According to your description, you want to change the each display as different color, when category group values is dynamic, right?

Follow the below example

In your scenario, you could specify the Fill color expression with Switch() or IIF() function. In my test environment, since we dont know how the dynamic category group changes, we specify each condition based on a fixed field. In your scenario, since category group values changed each time, the condition should refer to corresponding dynamic category group instead of a fixed field. 

Or you could add an additional field in the dataset to store color for each category value. Then you could specify the Fill color expression with this field. For more information, please refer to this similar thread:How to Have Different Colors per Category in a Bar Chart in SSRS 2008 R2.

If you have any question, please feel free to ask.

Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 4:14pm

Click on the Bar and then go to Series Properties and then Fill and write below Expressions

Change the Fields!MonathName.Value to your field you are using. Also change the Month Name to Full Name if your values are Full Month Name. I have used short month names.

=Switch(Fields!MonathName.Value="JAN","Green",
Fields!MonathName.Value="FEB","Blue",
Fields!MonathName.Value="MAR","Yellow",
Fields!MonathName.Value="Apr","Maroon",
Fields!MonathName.Value="May","Green",
Fields!MonathName.Value="Jun","Blue",
Fields!MonathName.Value="Jul","Yellow",
Fields!MonathName.Value="Aug","Maroon",
Fields!MonathName.Value="Sep","Green",
Fields!MonathName.Value="Oct","Blue",
Fields!MonathName.Value="Nov","Yellow",
Fields!MonathName.Value="Dec","Maroon",
)

All the best!

September 8th, 2015 5:25pm

This expression makes sense if we know that we have to color format based on months. How about for a situation when there are dynamic values instead of months and set of 4 colors are applies for every 4 values. Can we use MOD 4 in the expression.
Free Windows Admin Tool Kit Click here and download it now
September 11th, 2015 3:11pm

Hi DReddyC, 

According to your description, you want to set the column bar chart color, right? 

In your scenario, you can add a rownumber to the dataset query, and then use the field value to determine which color will be used. Please refer to the following sql query: 

Modify the query as below: 

select row_number() over (order by field) as number, * from table

Add the following expression to the color: 

=Switch(Fields!number.Value mod 4 = 1, "Blue",
Fields!number.Value mod 4 = 2, "Orange",
Fields!number.Value mod 4 = 3, "Green",
Fields!number.Value mod 4 = 0, "Pink"
)

The result is like below: 

Reference: 

Row_number

If you have any other question, please feel free to ask. 

Regards,
Shrek Li

September 13th, 2015 10:59pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics