different colors in same bar in ssrs

  • Hi everyone,

    I need a help ssrs experts..

    one of our client needs different colors in the same bar in ssrs.

    For example, refer the attached screenshot, If you see ADD group, upto value 150 it should be shown in blue color and above 150 it have to be shown in rose color.

    Can someone help me on this ?

    For better, quicker answers, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • The best way to do this would be using a series on your chart and using a stacked column chart. You can then have different colours like you have shown in your chart depending on what series it is. This will likely mean you'll need to change your data a little, so here some example SQL for how you'll need your data to look. The making of the chart should be relatively simple after that:

    Create Table #Temp (KPIGroup char(3),

    KPIColour varchar(50),

    KPIValue int)

    Insert into #Temp

    Values ('ADC','Cornflower', 82),

    ('ADD','Cornflower',150), --NOTE I have capped this at 150, as I need to change the colour!

    ('ADD', 'Rose', 106), --Now i have the rest of the column's value in a seperate row, but in the same Group

    ('AMD', 'Cornflower', 50)

    --I have added a windowwed fuction for total, as I noted in your sample picture that you only show the total

    --Note that you will need to hide it in the Cornflower colouring, if you have a Rose coloured series, it it'll apppar twice :(

    Select *,

    sum(KPIValue) over (partition by KPIGroup) as KPITotal

    from #Temp

    Drop Table #Temp

    Hope this helps.

    Edit: Though I'd add a sample image for how to create the chart for completeness.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • thank you so much for the reply. It is very useful.

    I have solved the same with stack reports...

    For better, quicker answers, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply