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

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.

Related

SSRS Bar Chart Conditional Formating

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")

Allow user input of chart axis in QlikView

I'm creating a scatter chart in QlikView. I'd like the field used for the y-axis of the chart to be user selectable. For example, I create a scatter plot, and choose my x-axis as "field1" and y-axis as "field2".The actual expression in QlikView for the y-axis is SUM([field2]). This works fine to plot field1 vs. field 2.
Now, I have a list box for the user to select a field (using $Field). I can get the name of that field using GetFieldSelections($Field). That works fine as an expression for the label, but it doesn't work as an expression to replace the equivalent of SUM([field2]). How do I set my expression so that if the user chose "field2" in the listbox, I get the same result as my hard-coded "field2" expression? I tried Sum(GetFieldSelections($Field)) and that doesn't work at all. I'm guessing I need some other function which returns the field values for an input string of a field name, but I don't know what that is.
Thanks!
You could try this syntax :
Sum ($(=GetFieldSelections($Field)))
I've build a small example and it seem to work.

SSRS - Expression not working after putting Subreport

I have trouble regarding expression.
I have a report that has a calendar style. (Screenshot below)
I have an expression on the Day Number on the top left of the calendar cell, and it works (Which is in the top box).
Here is the expression :
=IIf(IsNothing(Fields!DayNumberOfMonth.Value), " ", Fields!DayNumberOfMonth.Value)
But when I added my sub-report which returns the list of employees and their schedule per date, the Expression is not working anymore. Some random number appears on the top left of the box, which is supposed to be blank. (Screenshot below)
Here is the Design View :
Any solutions or suggestions? Thank you in advance, I will appreciate it very much.
Is it possible that your week number from your subreport is not correctly aligning with the main report. It looks like it is using the number 7 from the next Sunday.
I figured it out. I set the visibility to "Show or hide based on an expression, then set the expression to : =IIf(IsNothing(Fields!empName.Value), True, False)

Selected Dimension Value in Expression in QlikView

Just wondering how to get a selected value in an expression. I have the following bar chart, with drill down from Year to months.
When I click say 2011 bar I get the following chart.
Now is there a way to get Transported Mail - 2011 in the second chart instead of just plain Transported Mail. Note that 2011 is the current selected year. I want it to be incorporated in the label expression. Please guide.
You can use set analysis for this...
Try this:
= 'Transported Mail -' & concat({state_name} DISTINCT year_var,',')
Note If you haven't created any alternate states, you can use $ as your state_name
Now, you can get much more complicated with this to allow it to handle multiple years differently, but this should do the trick for you.

Reporting Services Chart - Custom Axis Label

I have a SQL Server Reporting Services (2008) chart (error chart). The X-axis has date intervals 1/1/2009, 2/1/2009, etc. The Y-axis has numeric intervals of 50. Values on the Y-axis are 0, 50 and 100. However, instead of displaying 0, 50 and 100 i would like to display "Small","Medium" and "Large" respectively. Does anyone know how this text replacement can be performed?
This is a bit of a hack, but here goes:
First, normalize your values around zero, so the smallest value is -50 and the largest value is 50. You can do this in the chart control itself, no need to change your dataset. Your values are between 0 and 100, so just subtract 50.
Next, under value axis properties -> axis options, set your minimum to -50, maximum to 50, and interval to 50.
Finally, under value axis properties -> Number, select Category as "Custom" and enter this in as the custom format expression: ="Large;Small;Medium"
(that's an excel format code: pos;neg;zero)
You should get something like this:
alt text http://img44.imageshack.us/img44/9011/chartz.png
According to Arbitrary Label for Y axis in SSRS Charts, you can achieve the similar effect by using strip line collection. See How to: Highlight Chart Data by Adding Strip Lines.