SSRS dynamic pie chart error - sql

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

Related

Oracle apex pie chart percentage and display

I am trying to display a pie chart on Oracle Apex as a percentage of each response of why a deal was rejected etc. The value of each chunk shows as equal chunks until you hover over the piece which shows it's value coming back in thousands rather than a percentage of 100. I know on the attributes setting of the pie chart you can put it as a percentage and on the format scaling the options are: Thousand, Million, Billion, Trillion and quadrillion. The SQL code I have for the pie chart is as follows
SELECT * FROM DEALS_RETURNED;
Deals_returned is the table name but I want it to count the column 'Reason' to show on the pie how many of each reason has been given for each rejected etc.
Tried to change the code to have
SELECT COUNT(Reason)
FROM DEALS_RETURNED

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

power bi: dynamic y-scale values based on data

I'm building a dashboard in power bi and I have a dataset with a few percentages. There are several categories of data, but only one category is shown at a time. What I want to do is to dynamically change the y-axis values to reflect the data. At the moment, it's done automatically, but it makes the data look "worse" than it is, so I want to take the min and the max for that one category and add let's say another 10-20% to it, and use those values as the new scale. For example, if my data starts at 41% and ends at 63%, power bi automatically scales the chart between around 40% and 65%. I want to take these values, add 10% on each side and have the chart start at 30% up to 75% (roughly).
Is there a way to do this?
Thanks
If your visual is a line diagram then you can solve it by adding two additional measures to the plot:
y_top = MAX([pct_measure])+0,1
y_bottom = MIN([pct_measure])-0,1
Add both to the line diagram and then set their line widths to 0.
It's a variation of this:
Power Bi Tips - Center X-axis on a line chart

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.

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

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)