SSRS Bar Chart Conditional Formating - sql

I am trying to conditional format a bar in my Bar Chart.
I am comparing Planned Time VS Actual time and I want to set a conditional format to display different colors IF Actual is less than or Equal to Planned then show me RED else GREEN.
I am unable to find a way to do this. Please Help!
I tried SWITCH and IIF functions but nothing happens. Same of my code attached.
=iif(Fields!ActualDuration.Value <= Fields!PlannedDuration.Value, "Light Coral", "Dark Sea Green")
I expect the bars to change color according to my criteria.

Because your chart sums the values, your expression for the Series Fill property also needs to use SUM:
=iif(SUM(Fields!ActualDuration.Value) <= SUM(Fields!PlannedDuration.Value), "Light Coral", "Dark Sea Green")

Related

Qlikview expression for percentage of bar (not total) in stacked bar chart

New to Qlikview, not yet familiar with scripting.
My data has two dimensions, Month and HSETimes (4 categories), and the expression is Count(HSETimes). A stacked bar chart using relative values returns the percentage of the total by month by category.
I need an expression to return each months total as 100% with each category proportionately represented to produce a bar chart similar to the attached image, but I do not know how to write the expression: have tried many combinations of subset and total to no avail. Should be simple: can anyone help? ChartSample
Using the relative checkbox on a bar chart rarely results in the desired output. To accomplish what you want, uncheck the "Relative" checkbox, and modify your expression to explicitly calculate the percentage you want.
Dimensions: Month, Category
Expression: count(HSETimes) / count(total<Month> HSETimes)
Using total<Month> is part of the set modifier syntax and will result in your denominator being the total per month while your numerator will still be the count for each month and category.
Also, ensure you have the "stacked" bar type selected in the "style" menu and set your number format in the "Number" menu to show in percent.
See here for more info on set modifiers. Or you can google 'set analysis', 'total modifier', 'set modifiers' and that should help you find more info.

Excel VBA : Use the color of a shape in an If/Then case

I have created a chart on Excel using macros. Each of the shapes on the chart is filled with a color according to its category. I was wondering if it is possible to use the color of the shapes in an If/Then case to perform different actions, such as displaying the shapes with specific colors only.
For example, something similar to:
If shape.Fill.ForeColor.SchemeColor = 1 Then
shape.delete
I have tried that, but it doesn't seem to do anything to my chart. Does anyone have an idea of how to do it?
Thank you !!
Did you try checking the color with the corresponding RGB value? Since SchemeColor depends on the current color scheme it might be looking for a different color than you'd expect

Flexible Data Label Formatting

I'm hoping to add custom data labels to a stacked bar chart in Excel 2010. Each bar will have a label value pulled from a value in the sheet which is not necessarily equal to the height of the bar itself.
The sheet I'm making is a template and has drop-down selections to change the units of the data. For example: $MM with 1 decimal point, K with 2 decimal points, $ with 0 decimal points, etc... I'm running into an issue formatting the labels to match the data formatting selections. I've tried two approaches:
Formatting the data labels themselves using VBA. Partial code below for $K with one decimal:
`With ActiveChart.SeriesCollection(x).Points(y)`
.DataLabel.Text.NumberFormat = "$#,##0.0,"
Unfortunately, the labels don't seem to read the commas and divide by one thousand, so I can't accurate display thousands or millions. A value of 1000 in the above code will display as $1,000.0 instead of the desired $1.0.
Format the values in the worksheet, and then just read them with VBA. Basically, I use conditional formatting to properly display the values on the sheet, and then read them with .DataLabel.Text = Cells(r,c)
Unfortunately, though the data is formatted correctly, the values are unchanged and the labels display with no custom formatting at all.
Is there any reasonable way to achieve my goal? I'm hoping there's a way to either (1) make commas count when changing data label number formats or (2) change the actual values of the data in my sheet based on the formatting drop-down selections (instead of just giving them custom formatting which leaves the value unchanged).
Thank you,
Lance
I think the words "conditional formatting" are your issue here: I've had problems with VBA reading the underlying format of a cell when it's conditionally formatted (admittedly, my issue was with colour, rather than number format, but I expect the reasons for it not working would be the same).
If you adopt your second approach, i.e. relying on the worksheet's format using the chart's "Linked to source" option, then on a trigger of when the drop-down option is changed, you could use VBA to set the format on the worksheet instead of using conditional formatting - then the chart would pick up whatever format you're using.
Please try this:
?Format(1000,"$#,##0.0,")
$1.000,0
?Format(1000,"$#,##0,.0")
$1,0
?Format(1234,"$#,##0,.0")
$1,2

Customized report colors "snapping" to windows default colors

I have a chart in an Access 2010 report for which I am trying to set colors of different series dynamically. The user can use checkboxes to select series to chart, with the intent being that the series on the chart will take its color from the BackColor property of the checkbox's label.
The problem is that when I run my code to create the report, the colors used are not the ones on the corresponding labels. Instead it looks like they are "snapping" to the list of colors at the following link, referred to as "standard windows colours". List of standard windows colors in RGB and Long
For example:
With myChart.SeriesCollection(1)
.Interior.Color = RGB(195, 215, 155)
End With
Sets series 1 to a dark grey color, and debug.print myChart.SeriesCollection(1).Interior.Color returns 12632256, rather than 10213315 like it should. (Long color = Red + Green*256 + Blue*65536)
I have tried opening the chart object and defining the custom colors that I want to see on the palette for the chart, and setting the appropriate colors for the series manually. This works until I try to programatically change anything, at which point, all of the colors snap to the list I linked above.
Any ideas for how to dynamically set chart colors to custom values?
Managed to answer my own question. Manually customizing the palette in MS Graph was necessary, but from there, I need to reference the colors by their index on the palette (using .Interior.ColorIndex), rather than from their RGB or Long code. The index numbers for the palette are not in any logical order, but can be found in a file accessible from this site.
It's not quite as dynamic as I had hoped for, but this is definitely good enough for what I need to do.

Highcharts: Polar columns datalabels inside position

I'm trying to get values (datalabels) of a columns polar chart INSIDE the actual column, and not on top of it. I've set inside: true property but it does not seem to have any effect, although it works pretty nicely while using a regular stacked columns chart for example.
Here is the fiddle showing the issue: http://jsfiddle.net/deurk/BeVyt/2/
Ideally, I'd like to have the datalabels in their "shares" if there is enough space, with white color. Does anyone have a workaround for this?
Thanks!
Indeed it looks like a bug, so I've reported it here https://github.com/highslide-software/highcharts.com/issues/1688