Report Builder 3.0 chart series custom sort - tsql

I need to add "Total" category in a bar chart in Report Builder. But there are percentage values(I can't aggregate them with SUM() function) so I have to customize my SQL code or write an expression for totals. I couldn't find anything to add Totals into charts in Report Builder interface so I decided to add a "Total" row by SQL but charts automatically sorts data A-Z or Z-A. How can I manipulate this feature? Adding Total group in chart series is the logical option, if you know how to add I prefer that.
To sort series, I tried IIF() function to change order of data in "Series Group Properties" window but I failed.
(like this we do in SQL
order by case when ColumnName = 'T' then '10' else ColumnName end desc
)
When I manipulate data by SQL to add Totals my data is like this in the chart:
P - Q - R - S - Total - W
I want it to be like this:
P - Q - R - S - W - Total

Related

Display values in the dashboard title based on filter selection in Tableau

I have a list of product names with some values tied to them. These product names are also applied as filter. Let's say these products are named as Prod A, Prod B, Prod C, Prod D, and Prod E. My goal is to display the product names which are selected in the filter as dashboard title, but the twist is that Prod C and Prod D together describe a new product called 'Personalized Product', which means if Prod C and Prod D are selected from the filter, the dashboard title should display Personalized Product whereas if only Prod C is selected in the filter, the title should be displayed as Prod C. Similarly, the other product names should be displayed in the title when selected individually from the filter. Is it possible to achieve this without using a parameter?
I have attached a sample workbook for reference in the link below with what I have done so far. https://drive.google.com/file/d/1w9aZTqw3ndo87HxUVwcP1lbj4yHW3hSZ/view?usp=sharing
Thanks!
One way to do this would be with an LOD calc and a context filter. You can create an LOD calculation a the Product Group level that determines how many products within that group are being shown. If it is more than 1, then show the group name, otherwise, show the product name. Next, use this instead of Product Name on your worksheets and add the Product Name filter to context. This way the calculation will only look at data that is currently on the worksheet when computing. Here is a calculation that would work:
{FIXED [Product Name (group)]:
IF COUNTD([Product Name]) > 1 THEN MIN([Product Name (group)])
ELSE MIN([Product Name])
END
}
Then if you want to showcase the selected products you can use a worksheet that lists out the products in place of the actual dashboard title. You can do this simply by just putting the calculation on text on a blank worksheet. Or, you can go a little nicer with a calculation to display them with punctuation like this:
PREVIOUS_VALUE("") +
IF FIRST() = 0 THEN ""
ELSEIF LAST() = 0 THEN " & "
ELSE ", " END
+ MIN([Group Calc])
And then add a filter for LAST() = 0 to keep just the last row:
Here's what the setup looks like:
Add the LAST() = 0 filter and hide lines and headers:
All together:

Tableau Target Vs. Actual - Can not get totals to show correctly

I am having trouble showing the correct totals in my tableau worksheet.
I have supervisors that are part of specific zones that need to complete a certain number of tests in different categories. For example, supervisor 15716 must complete 8 tests in category 1. I need to show the target, which is a number stored in the database and show the actual number of tests in that category that have been completed within a date range. I have it working, but Im not sure if I did it correctly because I can not show any totals.
System target - number stored in database
CountOfSheetID - calculated field
Percent Compliant - calculated field
Try this approach -
First define a calculated field called [Within Date Range?] as
[Date] >= [MyStartDate] AND [Date] <= [LastSelectedDayOfMonth]
and put that new field on the filter shelf, only including data where [Within Date Range?] is True. (You could also just filter the [Date] field if that is flexible enough for you)
The you don't need the CountofSheetId calculated field at all. If you want to know how many records have a non-null value for [SheetID] within your date range, you can simply drop [SheetID] on a shelf and choose to treat it as Measure with the aggregation function COUNT()
Then just build your visualization to show the counts you want (not percentages, the actual counts)
Finally, you can convert counts into Percentages by clicking on the pills for your Measures and choosing Percentage under Quick Table Calcs. You'll want to experiment with the "Compute Using" setting to tell Tableau how to compute your percentages -- i.e. define percentage of "what".
Percentages are implemented as table calcs in Tableau. Read the help to understand table calcs, especially the description of partitioning and addressing.

Display Report Contents Where Column A Equal B in SSRS

From the image above, I want viewers of my SSRS report to see data where PaymentFound column is equal to 'N' without limiting it in my T-Sql query and without hiding any column in my report.
How do I achieve this in SSRS?
I am assuming you want to hide the rows for which the PaymentFound value is Y.
There are 2 ways to do that,
1) Add filter on dataset so it will filter the values out with PaymentFound= Y
You can add filter as,
Dataset->RightClick-> DatasetProperties->Filter->Add-> then
Expression : PaymentFound
Operator: =
Value: 'N'
2) Right click on row set the expression for the visibility as
= IIF(Fields!PaymentFound.Value = "Y",True,False)

Hide rows with no values in hierarchial grouping in crystal reports

I have a crystal report - showing some financial data. As normal with financial data we have several general ledger accounts - which are grouped hierarchically. We are using grouping in Crystal report with some totals on hierarchical groups.
There are some rows where the values are zero. The groups also have total of zero as a result of this. We need to hide these rows. If we try to check the sum of the field - on the group level - it hides all the parent rows (since they themselves do not have any value - only values are derived from the child rows).
Need some way to do this in crystal?
You can suppress rows base on a condition.
In the menu go to Report->Suppress Expert...
Select the details line then select the formula button next to Suppress
You only need to put the condition that will be true to suppress the line
{[Your value field]} = 0
For groups, you will need to find the sum of your total for that particular group
SUM({[Your value field]}, {[field you are using to grouped by]}) = 0

Can't calculate sum for a column in iReport 4.6.0+XML datasource

I've built a report from an XML datasource. I've created two nested groups and I'm trying to calculate sum for a column and put total into deepest group footer band.
I've created a variable to aggregate values and a text field to print that variable out to group's footer band. However I'm getting 0.0 (which is initial value expression for my variable) as column sum for every group.
Let me specify some details:
- TargetGroup_DURATION: variable that aggregates values from column dur/#val
- Calculation = Sum
- Reset type = Group
- Reset group = Target Group
- Increment type = Group (I've tried also setting this property to Column, Now, and Auto)
- Increment group = Target Group
- Variable expression = NumberFormat.getInstance(new Locale("en", "US")).parse($F{dur/#val}).doubleValue()
- Text field on TargetGroup footer band
- Text field expression: $V{TargetGroup_DURATION}
- Evaluation time: Group (I've tried also Now, Column and Auto)
- Evaluation group: TargetGroup
As I said, I can't get right results. Does anybody now what's the appropriate values that I have to set in order to get right results?
Thanks in advance.