How do I sort SSRS Table Column Group on an value in decending order? - ssrs-2008

How do I set this GroupExpression to order in descending order:  =Fields!ID_Count.Value in descending order?

To sort values in a group, including the details group, for a Tablix
1 On the design surface, click in the tablix data region to select it. The Grouping pane displays the row groups and column groups for the Tablix data region.
2 In the Row Groups pane, right-click the group name, and then click Edit Group.
3 In the Tablix Group dialog box, click Sort.
4 For each sort expression, follow these steps:
1 Click Add.
2 Type or select an expression by which to sort the data.
3 From the Order column drop-down list, choose the sort direction for each expression. A-Z sorts the expression in ascending order. Z-A sorts the expression in descending order.
5 Click OK.
https://learn.microsoft.com/en-us/sql/reporting-services/report-design/sort-data-in-a-data-region-report-builder-and-ssrs

Related

How to group rows in Tableau into bands?

I'm fairly new to tableau and I'm having the following issue. Below is a sample of the data I'm using.
Count | Item
___________________
1 A
3 B
2 C
3 D
5 E
2 F
5 G
9 H
I'm trying to group some of these together so I can show a stacked bar chart of these groups like the following:
Count | Item
___________________
6 A-C
10 D-F
14 G-H
How to do this?
Use Tableau's built-in Create Group feature
View and download the solution workbook on Tableau Public:
https://public.tableau.com/profile/fosstin#!/vizhome/HowtoGroupYourDatainTableau/Dashboard-HowtoGroupYourData
Right-click the Item dimension and choose Create > Group. This will open the Create Group dialog window.
At the top of the window, in the Field Name text field, enter a name for your grouped dimension or use the default title provided by Tableau, which is Item (group)
Select the first set of letters you wish to group, then click the Group button. Multiselect rows by holding down the control key or the shift key.
Type in a name for the group(i.e. A-C) and press enter.
Repeat steps 5 and 6 to create the D-F and G-H groups, then click OK.
Drag the Item (group) dimension to the Rows shelf and the Count measure to Text in the Marks card.
Add a column header to the Count column by double-clicking Measure Values in the data pane.
Right-click the Measure Values pill now on the Marks card and choose Format. Then, in the formatting pane, choose Numbers > Number (Standard)
References:
Tableau Help: Group Your Data
https://help.tableau.com/current/pro/desktop/en-us/sortgroup_groups_creating.htm#create-a-group-from-a-field-in-the-data-pane
Tableau.com Blog: The one-click trick for create headers for single-measure tables
https://www.tableau.com/about/blog/2015/11/how-create-fast-headers-single-measure-tables-45945
You can use a CASE statement to create the groups. I named it group in my example.
CASE [Item]
WHEN 'A' THEN 'A-C'
WHEN 'B' THEN 'A-C'
WHEN 'C' THEN 'A-C'
WHEN 'D' THEN 'D-F'
WHEN 'E' THEN 'D-F'
WHEN 'F' THEN 'D-F'
WHEN 'G' THEN 'G-H'
WHEN 'H' THEN 'G-H'
END
Then add group to your Rows shelf and Count to your text.

SSRS sum of distinct values

I want sum of only unique values in SSRS report.Is there any logic to achieve this.
this is what something like this sum(distinct value)
Thanks
Supposed you have a column named value in your query, you could do the following:
Add an additional column to the query of the dataset:
ROW_NUMBER() OVER (PARTITION BY [value] ORDER BY [value]) AS valueNr
Then, if you already have created a Sum field in the table, change the expression of the textbox to
=Sum(Iif(Fields!valueNr.Value=1, Fields!value.Value, 0))
Repeat this for every "distinct sum" calculation.
Yes. You use groups. At the top click the insert menu, then table, then Table Wizard. Pick your dataset and hit next. Now drag the column for the different types of items you want a distinct sum of into the Row Groups section. Drag your count column into the Values section. This should automatically turn it into Sum(ColumnName). You can click the down arrow to change the aggregate type (if desired). Press next and next and finish. Viola. You have a distinct sum for each specified field.

Tableau Count distinct of count distinct

I have below data
Name Product
XYZ A
XYZ B
XYZ A
MAP Z
MAP Z
I want only those customers that have more than 2 distinct products. So in the above example, we get only XYZ, so the count is 1.
Not sure how to do it.
Thanks,
Hema
If you only want to see the customers without information on the different products, you can drag the Name pill to rows, create a calculated field distinct_products as
COUNTD([Product])
and drag it to filter. Select 'at least' and enter '2'.
If you still want to see the product information you can solve this using Level of Detail expressions in Tableau together with a filter.
Create a new calculated field distinct_products as follows:
{exclude [Product]: COUNTD([Product])}
Drag this to filters and choose attribute. Then select 'At Least' and enter '2' as value. Now the filter is in place. What you then need is to drag the 'Name' pill to rows.
If you want the products to be shown in a single row: drag the Product pill to 'Text'. If you want the products to appear in multiple rows, drag it to rows.

Tableau 8.2: how do I sort across all item numbers?

I am using Tableau 8.2.
I would like to sort, but am having difficulty trying to get to my end result.
I have an item number: the item numbers are repeated multiple times.
I have a criteria1 field, and a criteria2 field.
I would like to experiment sorting on all the criteria1 fields, then all the criteria2 fields.
For my rows, I have "item number", "criteria1", "criteria2", along with other data.
When I click above the "criteria1" in the list of rows, I get a "sort" function.
The sort function has sever different combinations:
The first is "sort order", there are clicks for "ascending" and "descending".
Next is "sort by", there are clicks for "data source order", "alphabetic" and "field". The "field" has a combobox for different field names.
The last group is for "manual". This shows all values, but not in true sort order.
I have tried using many different combinations for the sort, but cannot get it to work the way I would like. I would like a sort across all the items, descending.
How can I get the sort to sort descending across all the items, first by "criteria1"? Then, how can I sort by "criteria2"?
I don't quite understand what problem you're facing. Let me explain how sorting works in Tableau, and you tell me what's happening in case it's not helpful.
Each dimension has a Sort property (you can right-click a dimension, Default Properties and Sort. You can choose to sort ascending or descending, on alphabetic, numeric or data source order. Or even manually sort (top items come first, bottom items come last, use Up and Down button to shuffle)
When you drag those dimensions to the worksheet, Tableau will automatically use that Sort Property. More over, it will follow a hierarchy, the first dimension (in Row or Column) will be sorted first, then the second dimension will be sorted inside each bucket of the first dimension. SO, if you have a field with [A,B,C,D] and a second field with [1,2,3,4], one possible outcome could be (using descending order, first the letters than the numbers):
D 3
2
1
C 3
2
B 4
3
1
A 4
3
In that example, what exactly would you be trying to achieve?

How to show empty groups in crystal?

I have a report that shows items by goups.
Lets say he groups are:
In Inventory
In Process
When there is no data In Inventory, that row is not shown. any idea how to show a row with 0 inventory?
It sounds as though you are grouping on a field (such as stock item status), where there may be 0 rows returned for certain values of the field (such as In Inventory). The answer is to amend your query to right outer join to a lookup table holding all values of the grouping field, for example as follows:
select lu.status_value stock_item_status,
si.stock_item_status item_status,
si.stock_item_id,
coalesce(si.quantity,0) quantity
from stock_item si
right join stock_item_status lu
on si.stock_item_status = lu.status_value
This will now include a row returned for stock_item_status values with no corresponding stock_items, with null values for all of the stock_item fields.
If you were including a subtotal of stock_item.quantity values for each status, changing this to coalesce(...,0) should ensure that this null value is displayed as 0.
If I'm understanding you correctly, you've got a field {table.inventory} that holds the number of items in inventory that has a null value when the inventory is zero? When you group on this field you're not seeing the rows with null values in this field?
Crystal should still display those rows, just in a group with a null group name. To fix this you can go into the Group Expert -> Select the group in question -> Options -> Options tab -> Select 'customize group name field' -> and then specify a formula as a new group name field where you simply check to see
if isnull({table.inventory}) then 0 else {table.inventory}
Similarly, you can just create a formula that does this and group on that instead.