SSRS Chart: Filtering and controlling axis maximum - sql-server

I am creating a chart off in SSRS based on software version usage per month. I would like to compare how often each version is used per month in comparison to other versions. The image I'm working with is below:
Obviously with one version being used so highly, it visually skews my data, making the rest of the data harder to see. I am curious if there is any way to do the following things in SSRS:
Having the user Toggle /select/choose which versions they would like to appear on the chart, with the chart then automatically adjusting its Y-Axis settings
Having the user adjust the y-axis settings themselves, thus being able to get a closer look or a zoomed out look of the data.

There are a few questions here.
Here's my base report:
Parameter-based axis
You can definitely set axis limits with a parameter. I created a parameter called AxisLimit and set Maximum property to use this parameter under Axis Options -> Set axis scale and style:
Works as required:
Filtering by parameter
You can also set up the report to filter values based on a user selection.
You can apply this to the DataSet in the query text or as a parameter to an underlying stored procedure.
If you need the data elsewhere in the report and can't apply this at the DataSet level, you can set up a filter at the chart level. I set up a multi-value parameter called Groups which contains the groups in the DataSet.
At the report I set the filter as:
Where the expression is:
=IIf(InStr(Join(Parameters!Groups.Value, ",")
, CStr(Fields!grp.Value)) > 0
, "INCLUDE", "EXCLUDE")
Here I use the Join function to get the list of selected parameters values, then filter the DataSet based on these. Again, works as required:
Scale breaks
One option you might not have considered is Scale Breaks, which is meant to help with this sort of data:
Maybe this will help, too.

Related

MS Report Builder Pareto Chart Unable to sort Categories

I am attempting to build a industry standard pareto chart in MS Report Builder. The chart below is a generic example of what I want to see. The problem is that my categories are not ordered by the transaction_sum for that category, but by the name of the category. If I go to CategoryGroups Collection and specify that the sort expression be based on the transaction_amount field and click OK and run the report chart, it is ordered alphabetically on category. I go back into CategoryGroups Collection and the custom expression is gone and it has reverted to the category. I have found no solution to this issue.
So I thought I would go into the query for the dataset and add a new field ModCat consisting of a single character prepended to the category field i.e. 'ARent', 'BFood', CUtilities', 'DGym', 'ESmall_expense'. I use that as category in my chart and it sorts based one the transaction_sum! Excellent, but I still need to strip that ordering letter from the category labels. So I write a LabelsFormat expression for the vertical category axis that uses MID to remove that first letter. But when I run the report the 'ordering' letter is still there. If I just use the original category field for the LabelsFormat it just ignores it. Am I missing something here? Is it really that hard to create a simple pareto chart in Report Builder? Any inputs are much appreciated. Thank you

Way to calculate difference between Tab Filter and Overall in Google Data Studio?

I have a calculated value in Google Data Studio that a client wants to see as follows:
Result = Value (No filters on page applied) - Value (Filters on page applied dynamically)
I don't know how to calculate or accomplish this in Google Data Studio or if this is possible. Can someone show me if this solution is possible?
There are two workarounds:
Parameters
Instead of using filters, create a parameter1 and a field with the function
Value -
case when parameter1=some_field then Value
else 0 end
Blend
Duplicate the data source and hide all field which shall not be filtered. Blend this data source with the original one and use as joining keys the dimension which are not filtered. Use the field Value in both sets as metrics and rename it as filtered / not filtered.
Add a chart and add in this chart a metric field with a formula substracting these two Value fields.

Printing records with condition Crystal reports

I am using stored procedure in mssql as backend, vb.net as frontend (just info).
There are a lot of records in the database and I am printing in crystal reports.
Now I want to filter the records from crystal report and not by adding a new parameter to procedure or changing database structure or else.
For now,Say there are columns : Name , Amount.
I want to put filter in amount like only display records whose amount above 100 or something. So other records with less than 100 should not be displayed.
This filter will be passed by the user so it'll be random.
I can't find a proper answer on internet. Might be a duplicate question, if so please post the link of the question if it is duplicated.!
Thanx anyways...!
In general the idea is to:
Create the parameter (user choose what will be the input/value) - link
Set filters, what values should be displayed in regards to parameter - link
On right side there is a DataExplorer window, where You need to add a Parameter (define his name, what question will be shown to user and what type the param will be / what values can be set inside).
Once done, You can jump to Data tab of a report, click Interactive Filter and specify which column must fit what condition with what value = Parameter (that one user will enter in Report).
Example: I will create AmountParam, with message "What should be the minimum amount?". Type will be set to Integer. Going to Report->Data->Interactive Filter, choose Amount as a Column, AmountParam as a Parameter and set condition Greater then (>).

Report Builder 3.0 Add Data Elements to an Array

I'm currently working on building a dashboard for some hospital metrics. The state requires that we report median key times. This dashboard will need to display the group median time for each day and the total column will need to display the entire dataset's median.
I'm working with Report Builder 3.0 and SQL Server 2014.
I've built a stored procedure that can calculate all these values accurately but accomplishing the mean this way makes expanding the dataset a bit of a monster when a new field needs to be pulled in.
All the articles (like as this one) I've read for calculating median within Report Builder point to needing to display (or insert and hide) all the data from the dataset. This method seems really hacky to me and is going to make this dashboard an absolute monster to try to manage as it grows.
What I need to know is, is there any way to pass the group values to a custom code function? The report has to have access to the group values at some point or else it wouldn't be able to perform the built in aggregate functions (Sum, First, Last, etc) on these groups. If I can't pass these values as an array to a custom code function, does anybody know how the group aggregate functions are built?
Thanks in advance to any who might have a direction to point me.
You can pass the values from the procedure to a function within SSRS and then have it just display the resulting median. I'll just give you summary to get you started.
Create a hidden parameter that allows multiple values.
Set its available values to pull from the dataset that is populated by your stored procedure.
Also set its default value so that all values are selected by default.
Go to the Code section of the report properties to write your function.
The function will take the parameter as an argument like this Public Function MyFunc(ByVal p1 as object()) as Integer
In the function you can refer to p1.Length and an item in the array like so: p1(i)
In the report you can call the function in an expression like this: =Code.MyFunc(Parameters!p1.Value)
Hope this points you in the right direction.

UNION multiple datasets in SSRS outside query

I have two data sets with exactly the same fields that I would like to combine into one dataset.
I cannot put a UNION/JOIN and make it return one dataset in the query as all data is encrypted and gets decrypted by an assembly reference loaded in SSRS (so I cannot run the necessary WHERE's unless I use a filter once the data is in SSRS).
I can return the second dataset using Lookup/LookupSet however I am using this data in a bar chart so (somehow) need both sets of data to display on it. If I was using a tablix I would be able to "hack" it by putting a second tablix without headers underneath the main tablix and show it like that. Unfortunately being a graph I cannot do this.
I also tried running it as one dataset, returning all values and then running "filters" based on category groups in the chart however for whatever reason [bug in SSRS?] the filter on these filters the whole result set, not just the one category group.
Is what I am trying to do possible in SSRS? Seems so basic but after a week of trying I have just about given up!
Merging two datasets is not possible but there may be a way to fake it for your chart purposes by doing a SUM of LookUpSet. What ever field is used as your value needs to be looked up using whatever criteria is being used for your axis.
Let's say you're displaying sales by month. Your value field is SUM(Fields!TotalSales.value) and your date field is Fields!month.value. You'd want to add the value from dataset1 and lookup the total from dataset2 - like:
=Fields!TotalSales.value + Code.SumLookup( LookupSet(Fields!month.Value, Fields!month.Value, Fields!TotalSales.value, "Dataset2") )
Unfortunately, SSRS doesn't let you sum a lookupset (so what's the point of it?), so you have to use custom code to do it.
Function SumLookup(ByVal items As Object()) As Decimal
If items Is Nothing Then
Return Nothing
End If
Dim suma As Decimal = New Decimal()
suma = 0
For Each item As Object In items
suma += Convert.ToDecimal(item)
Next
Return suma
End Function
Stolen from: How to combine aggregates within a group with aggregates across groups within SSRS
You're data is obviously different but the concept should be the same.

Resources