How can I populate a SSRS Chart with a calculated field? - sql

I am trying to populate a bar chart in SSRS using the following calculated field:
=COUNT(IIF(Fields!JobDeployment.Value <"1440",1,Nothing))/Count(Fields!CaseStatus.Value)
To explain it is the amount of tasks that have taken under a day to complete divided by the amount of tasks.
This is then attributed as a percentage each month and the end game would be that these percentages are in a bar chart.
Now when I select my bar chart with the Values series being the above calculated field it doesn't return any values
The data is correct in the table so I'm happy with that but when I want it in graph form, I am getting no results.
Could someone please be kind enough to give some pointers as to why this is the case
Thanks
Dan

If you're using Visual Studio (as opposed to Report Builder) you should get an error message explaining why it didn't work. The expressions you can use within charts are limited. Instead, you can have the logic done at the dataset level and leave the aggregation to the chart.
Add a calculated field to your dataset to check your condition.
=IIf(Fields!JobDeployment.Value < "1440", 1, Nothing)
In the chart, just compare the counts.
=COUNT(Fields!FilteredJobDeployment.Value) / Count(Fields!CaseStatus.Value)

Related

How to convert a panel bar chart to multi-line chart in tableau

I am trying to create multi-line subplots such that each subplot represents a rating factor on which firms are rated, and each line represents a firm's change in rating over time. Note that I don't have the date field. I have a string field that says which quarter of the year the Mean of ratings belong to.
I'm new to tableau and I created something like this:
I want to create multiple subplots: one subplot for each of the 8 rating features in the above diagram, and the subplot has multiple lines representing the variation over time for each company. I have 10 companies.
Please guide me on how to achieve this?
A rough sketch of how I Imagine the plot to look like is below:
This will teach you how to make a panel chart in Tableau: https://tarsolutions.co.uk/blog/build-a-dynamic-panel-chart-in-tableau/
It shouldn't to too complex for what you're attempting (fingers crossed!).
Building the panel chart is a little tricky in Tableau. Not terribly hard once you understand table calcs. I suggest starting simpler by moving Measure Names from the Rows shelf to the Pages shelf, then creating the line charts you want - 1 per page. Then learn about table calc partitions and addressing, including “At the Level” to have the info needed to define the panels
To make a colored line chart,
You need one field on columns that you set to display as continuous, making it green. If it is a date field, right click on the field and choose from the second set of groups, like month or quarter.
You need a continuous field on the Rows shelf, use Measure Values in your case
Use a discrete field on color to determine the number of lines, say Shortname
Set the Mark Type to either Automatic or line

PowerBI Dynamic Time Series BarChart

Adding on my previous question here: TimeSeries question
I would like to plot a unit capacity chart over a Time series (which contains a range of dates set by the user).
The chart I am trying to plot is as follows:
For each Unit Name, I have start and end date for the unit capacities, as shown in the PowerBI table as below:
4 sub questions:
How to plot these capacities over time? Maybe using some DAX functions?
Do i need the SSAS cube to solve this problem or can I do all the work inside PowerBI desktop? If not, is there a better way for example in SSRS?
Is there a way to make the x-axis time series dynamic as specified by the user?
Adding to this, after Leonard's response. After converting the OutageStartDateOrig, and OutageEndDateOrig values I tried to create the calculated column as suggested in the youtube link {enter link description here}. However, the DAX formula as shown in the video gives out a syntax error for me stating that the '.' is incorrect when specifying the range of dates. Any ideas for this? [Screenshot below]:
To create such a visual, I'd recommend an area chart (or stacked area chart) with the date on the axis, the unit name on the legend, and the capacity on the values. You could also do it as a stacked column chart too. However, then each date will be broken into discrete columns. See below image.
In terms of data manipulation, you'll need to convert the data with the date ranges you have above into a row for each individual date & unit. E.g. the first row, instead of being 11/2 to 13/2, would be expanded into 3 rows, one for each date.
You can do this in Power Query as you bring the data into Power BI Desktop, or in DAX after bringing it in. There are several solutions to this outlined in this thread (https://community.powerbi.com/t5/Desktop/Convert-date-ranges-into-list-of-dates/td-p/129418), but personally, I recommend the technique (and video) posted by MarcelBeug (https://youtu.be/QSXzhb-EwHM).
You'll also want an independent list of dates (with no gaps) to join the final date column to - otherwise your visual will skip dates when no units had capacity. By default, the chart will begin on the first date with data and end on the last date with data, so in that sense it is dynamic, but you can add a date slicer to give the end-user more control.
Area chart on top, column chart on bottom, date slicer on right filtering Jan-Mar.

SSRS Matrix Report : Colors condition

I have a matrix table created with Rows as Days ,Columns as Months and quantity of rainfall as the data field(got all this information from same table 'Rainfall'). I have taken this data from a dataset containing multiple tables in SQL. All of this information displays properly.
Now I have many tables with date field in my dataset in tables other than 'Rainfall'.
In the data field of the matix I need to be able to add my own colors using a Switch case.
The Condition I need is "if a certain date from one table matches the date in my report then i want xxx colour."
eg: there is a table called fertilization which has 3 dates. Now if these 3 dates also exists in my matrix then that block should be colored blue.
Can anyone help me. Thanks!
You can also manage it from sql side while retrieving data from Rainfall table.
You can do this using by right clicking the field that you want the dynamic color on and selecting properties. Select Border and then where it says color hit, click the Fx button. Here you can write a custom expression that will change the background color based upon your code.

SSRS dynamic pie chart error

I have a query that gives this output (this is a result from a udf, the denseRank is created as an filter for the pie charts, only this denseRanks stays as 1,2,3.. as the number of scenarios can be changing, so if I had 3 scenarios, there would be 6 lines with denseRank 3 at the bottom. for each scenario, there are always these 2 lines, capex and opex with cost):
Now I'm creating a set of pie charts that gives the percentage of capex and opex costs for each scenario.
So for example in the first pie chart, I've set the filter in category group properties as denseRank=1 as this is for my first scenario, see picture below. Similarly, I've set denseRank=2 in my second pie chart as it is for my second scenario.
And in the series label properties, I have the label expression as this (dataset2 is where the query that creates the above table):
I have a bunch of other settings like, show label as percentage with no decimal, piestartangle=270 etc.. Now I run my report and it is giving me this: the problem is the portion looks right, but the label is showing the the percentage based on the overall cost, but it really should be the percentage within each scenario, so for example 21% and 79% for scenario 1.
Is there any setting/function that I need to add? any way that I can get the right percentages without adding additional query/dataset to do the pie charts individually?
Sorry for the long post, really appreciate if you can help!!
got it figure out...
label expression to use sum iif denseRank=1, also use cdbl to convert non-integer to .00

Pentaho Report Designer: How to create a chart based on an OLAP cube?

Using Pentaho Report Designer, I can successfully display my OLAP cube's data as a table.
But when I want to display the same data as a chart, it always fail saying "CHART.USER_NO_DATA_AVAILABLE".
Actually, I don't really know what I should enter for category-column and value-columns. I tried:
category-column = [Area].[prefecture]
value-columns = [[Product].[Product.Product].[All Products].[productA]]
And any other variation I could think of, but no success. Any idea? Thanks!
My OLAP cube is a Pentaho Analysis: sales count for each product and prefecture.
Just use:
[Product].[Product.Product].[All Products].[productA]
You only need the extra square brackets around the entire fieldname if it's a formula.
Or pick the field from the dropdown.. then you know you have the right one!
If you're doing a timeseries xy, note you have to repeat the category column value as many times as the value column.
also make sure you have a series name too.