How do I group values by row in SSRS? - reporting-services

I am new to SSRS and need some help.
I am using a Matrix to Pivot my data.
Dataset looks like this:
TEST TOOLID
----- ------
TEST1 123
TEST1 234
TEST2 456
What I currently have is this:
TEST1 TEST2
TOOL ID 123 N/A
TOOL ID 234 N/A
TOOL ID N/A 456
The output I am looking for is (NULLS should be converted to N/A):
TEST1 TEST2
TOOL ID 1 123 456
TOOL ID 2 234 N/A
Thanks
jlimited

Choose Details in lower left of view pane under 'Row Groups'
Right Click>Add Group>Parent Group
Choose your item you want to group by, include header is the standard behavior(check box to select). Hit okay.
You are now grouping your columns and you should see a bit more geometric ( in the gray space before the rows showing they are grouped accordingly now.

Related

SSRS: Multi-value parameter with repeated values

I'm having issues with multi-value parameters. I was expecting I could load distinct values for the label and value combination from the default dataset but it's not working.
I have a query that looks like this:
Id Name Col1 Col2
1 Foo aaa ddd
1 Foo xxx sss
1 Foo yyy zzz
2 Bar bbb eee
3 Huh ccc fff
And want to grab the ID - Name combo from the dataset. Ideally, the results would be:
Value Label
1 Foo
2 Bar
3 Huh
However, the actual results are:
Value Label
1 Foo
1 Foo
1 Foo
2 Bar
3 Huh
EDIT: I consider this a poor solution, but made a new dataset only to collect the fields as I needed them and populate the parameter dropdown list. It's not the prettiest outcome, but should work until I find a proper way to do it.
Some of my colleagues are telling me this is the only way to do it, so I have to create a new data set every time I want to fill a new multi-value parameter from a query... Please tell me if it's actually the way to do it, I find it extremely inefficient.
You have to create a dataset for each parameter in order to feed it properly.

Perform action on selected columns depending on their name

I've got a huge table, containing three "selection"-columns and many "data"-columns.
ID Thing1 Thing2 Thing3 avgData1 avgData2 highestEtc
---- -------- -------- -------- ---------- ---------- ------------
1 1 2 2 321 654 999
2 2 1 1 123 456 11
3 2 1 1 987 789 77
4 2 1 1 765 567 11
In my queries, I'm now selecting all entries with "Thing1" = x, "Thing2" = y, "Thing3" = z (Those three columns are selection-criteria.)
The purpose of getting those lines is to perform an action on each of the following data-columns: If it starts with "avg", I want to calculate an average of the specific column on all selected entries. On another prefix I want to count which number appears the most.
Is there a way of letting the MySQL Database do all this for me? I need a SQL-Statement that calculates the averages of the columns automatically, and performs other actions too.
For example, let's say I'd select the criteria Thing1=2, Thing2=1 and Thing3=1. Is there a way of writing the statement so that it returns only ONE entry, with the calculated things?
Result
----------------- ----------------- ----
(123+987+765)/3 (456+789+567)/3 11
I heard that this should be possible, and that it is a bad method of NOT letting the database perform those actions directly. Unfortunately, I have no idea how to do it.
Try this:-
SELECT ID, AVG(avgData1) AS RESULT1, AVG(avgData2) AS RESULT2, highestEtc
FROM YOUR_TAB
WHERE Thing1 = 2
AND Thing2 = 1
AND Thing3 = 1
GROUP BY ID
HAVING COUNT(highestEtc) > 1;
Hope this helps you.

SSRS - Display grouped detail columns in multiple rows in section

I have to prepare a report in SSRS and getting a result set of stocks group by on stock number. I have show some columns in one row but others beneath this row and 5 separated rows. Its a detail report should be displayed in section like below. All columns in dataset are in one row. I have tried many ways but cannot create such format. Please SSRS experts provide some suggestions.
Stock# Description Inventory column4 column5 column6 column7
00001 Some stock 9034 122 xyz 123 ABC
--------------------------------------------------------------------------------
Product: Product1
Catalog: Catalog1
Buyer : Buyer Vendor-1: Vendor1 Price:455 Date:mm/dd/yy
Alias : xyz
Notes: comments
Tendor#: 4334 Vendor:Vendorx
--------------------------------------------------------------------------------
Totals: 89908.7998
00002 Some stock 8034 422 xyz 123 ABC
--------------------------------------------------------------------------------
Product: Product2
Catalog: Catalog2
Buyer : Buyer2 Vendor-2: Vendor2 Price:555 Date:mm/dd/yy
Alias : xyz
Notes: comments2
Tendor#: 5634 Vendor:Vendorx
--------------------------------------------------------------------------------
Totals: 89908.7998
I got the solution. Use List control and found this at this link.
http://blogs.technet.com/b/microsoft_in_education/archive/2013/03/09/ssrs-using-a-list-item-to-display-details.aspx
Got what I was looking.

Retrieve single name and multiple records

I have a requirement in my app which has multiple members and single name.In my web app i need to create a groups of some users.So suppose there are 2 groups test1 and test2.test1 group has 1 and 2 members and test2 has members 1,2 and 3(1 or 2 or 3 are not numbers consider them as group memebers.
My web app has 2 columns.if retrieve select * from groups then the output is like the following
groupname groupMembers
test1 1
test1 2
test2 1
test2 2
test2 3
but I want output like this
groupname groupMembers
test1 1
2
1
test2 2
3
So is it possible using any sql query.i am using jdbc for retrieving from mysql.
this is sqlfiddle http://sqlfiddle.com/#!2/d4610/1
You can do like that:
select name, GROUP_CONCAT(age) from groups group by name;
That's not exactly the ouput you want but i hope it helps

MySQL: create new table with frequencies based on data from original table

There are two important fields kernel and property in the table mydata:
I want to CREATE a new table myresults with columns rightTwoKernelSymbols, property and frequency based only on mydata table so, that it displays the frequency of right two letters among kernel column. (property values should be equivalent, otherwise count separately)
So, using another words:
Here is 'mydata' table. I modify 'kernel' column by leaving only two right symbols in each cell.
Using this table, I want to count distinct pairs (kernel, property) and save the data into myresults table.
Example:
mydata Table
czzzaa - 123
abc80 - 123
aaaaaaaa - 123
zz5 - 123
abc80 - 456
modified Table
aa - 123
80 - 123
aa - 123
z5 - 123
80 - 456
myresults Table
aa - 123 - 2 // czzzaa and aaaaaaaa - total two times (123 is the same)
80 - 123 - 1
z5 - 123 - 1
80 - 456 - 1 //we don't count abc80 and abc80 together, because 123 is different from 456
OK, here is my answer on my own question. Please let me know if there are any pitfalls that weren't mentioned.
CREATE TABLE results AS SELECT right(kernel, 2) as two , property, COUNT(*) as count FROM mydata GROUP BY two, property ORDER BY count DESC;