SSRS Multiple Column - ssrs-tablix

I am new to this SSRS.
I have a record like this:
Table Denomination ResultType Quantity
A1 1.00 FC 5
A1 1.00 FR 10
A1 2.00 FC 21
A1 2.00 FR 23
A1 5.00 FC 11
A1 5.00 FR 16
A2 1.00 FC 15
A2 1.00 FR 20
A2 2.00 FC 25
A2 2.00 FR 26
A2 5.00 FC 10
A2 5.00 FR 17
I am only able to do 1 part using matrix. I'd tried using pivot too but due to the denomination is a dynamic field.
FC
Denomination 1.00 2.00 5.00
------------ ---- ---- ----
A1 5 21 11
A2 15 25 10
I want to populate something like this using tablix instead.
FC | FR
Denomination 1.00 2.00 5.00 | 1.00 2.00 5.00
------------ ---- ---- ---- ---- ---- ----
A1 5 21 11 10 23 16
A2 15 25 10 20 26 17
Thank you.

It might be a little late to help you but...
You should be able to do this be creating a matrix (tablix in BIDS 2005) with Table(? - the field with your A1, A2 data) as the Row Group and Denomination as the Column Group.
Then in the Column Groups, click on the Denomination group down arrow and Add Group->Parent Group and Group By ResultType. This will add the extra layer to the columns by FC and FR in your last example.

Related

Creating subset of a data

I have a column called Project_Id which lists the names of many different projects, say Project A, Project B and so on. A second column lists the sales for each project.
A third column shows time series information. For example:
Project_ID Sales Time Series Information
A 10 1
A 25 2
A 31 3
A 59 4
B 22 1
B 38 2
B 76 3
C 82 1
C 23 2
C 83 3
C 12 4
C 90 5
D 14 1
D 62 2
From this dataset, I need to choose (and thus create a new data set) only those projects which have at least 4 time series points, say, to get the new dataset (How do I get this by using an R code, is my question):
Project_ID Sales Time Series Information
A 10 1
A 25 2
A 31 3
A 59 4
C 82 1
C 23 2
C 83 3
C 12 4
C 90 5
Could someone please help?
Thanks a lot!
I tried to do some filtering with R but had little success.

Stata: Transposing panel rows to column

I am trying to rearrange the following panel data set into a form where I can merge with another. I would like to transform this:
Gender Year IndA IndB IndC
1 2008 0.22 0.34 0.45
2 2008 0.78 0.66 0.55
1 2009 0.25 0.36 0.49
2 2009 0.75 0.64 0.51
1 2010 0.28 0.38 0.48
2 2010 0.72 0.62 0.52
Into:
(ID) Year Industry 1 2
1 2008 A 0.22 0.78
2 2009 A 0.25 0.75
3 2010 A 0.28 0.72
4 2008 B 0.34 0.66
5 2009 B 0.36 0.64
6 2010 B 0.38 0.62
7 2008 C 0.45 0.55
8 2009 C 0.49 0.51
9 2010 C 0.38 0.62
I am new to Stata and am having difficulties reshaping both the columns and the genders.
See help reshape. One way to do this is consecutive reshapes. You can execute the first line, look at the data in the data browser, then execute the second line to see how this works. You will also need to choose a name other than 1 and 2 for the final variables.
reshape long Ind, i(Year Gender) j(Industry) string
reshape wide Ind, i(Year Industry) j(Gender)
You can also replace the first reshape with a stack (less legible, but can sometimes be faster than a reshape):
stack Gender Year IndA Gender Year IndB Gender Year IndC, into(Gender Year Y) clear
rename _stack Industry
lab define Industry 1 "A" 2 "B" 3 "C"
lab val Industry Industry
reshape wide Y, i(Industry Year) j(Gender)
sort Industry Year
gen id = _n
order id Year Industry
list, sepby(Industry) noobs
As a third variation on the same theme, note that proportions for the two Genders sum to 1, so we only need one.
clear
input Gender Year IndA IndB IndC
1 2008 0.22 0.34 0.45
2 2008 0.78 0.66 0.55
1 2009 0.25 0.36 0.49
2 2009 0.75 0.64 0.51
1 2010 0.28 0.38 0.48
2 2010 0.72 0.62 0.52
end
drop if Gender == 1
drop Gender
reshape long Ind , i(Year) j(Type) string
list , sepby(Year)
+-------------------+
| Year Type Ind |
|-------------------|
1. | 2008 A .78 |
2. | 2008 B .66 |
3. | 2008 C .55 |
|-------------------|
4. | 2009 A .75 |
5. | 2009 B .64 |
6. | 2009 C .51 |
|-------------------|
7. | 2010 A .72 |
8. | 2010 B .62 |
9. | 2010 C .52 |
+-------------------+

Oracle LEAD & LAG analytics functions

I have a temp table using to test and need direction with some analytics function. Still trying to figure out my real solution.. and any help to lead me in right direction will be appreciated.
A1 B1
40 5
50 4
60 3
70 2
90 1
Tyring to find the previous value and subtract and add the column
SELECT A1, B1,
(A1-B1) AS C1,
(A1-B1) + LEAD((A1-B1),1,0) OVER (ORDER BY ROWNUM) AS G1
FROM TEST;
The output is not what I expect
A1 B1 C1
40 5 35
50 4 46
60 3 57
70 2 68
90 1 89
From last rows (5th row), first subtract A1 -B2 to get C1..then (C1+ previous A1) - previous row B1 that is ---> 89 + 70 - 2 = 157 (save results in C1 previous row)
4th row: 157+60 -3 = 214
repeat until the first row...
Expected final output should be ;--
A1 B1 C1
40 5 295
50 4 260
60 3 214
70 2 157
90 1 89
LAG and LEAD only get a single row's value not an aggregation of multiple rows and it is not applied recursively.
You want:
SELECT A1,
B1,
SUM( A1 - B1 ) OVER ( ORDER BY ROWNUM
ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
) AS C1
FROM test;

Merging two files and ordering them

I want to merge two files in one and order them based on the values of the second column. The example is the following:
File 1:
+ 1.01 id 120
- 1.20 id 145
+ 2.15 id 411
(continues)
File 2:
r 0.21 id 4
r 1.78 id 85
r 102 id 850
(continues)
I want to merge them in one file but I would like to put them in ascending order based on the column 2 like this:
File 3:
r 0.21 id 4
+ 1.01 id 120
- 1.20 id 145
r 1.78 id 85
+ 2.15 id 411
r 102 id 850
How could I do this?
how about
sort -k2n file1 file2
f1 and f2 are your files:
kent$ sort -k2n f1 f2
r 0.21 id 4
+ 1.01 id 120
- 1.20 id 145
r 1.78 id 85
+ 2.15 id 411
r 102 id 850

BioPython: Residues size differ from position

I'm currently working with a data set of PDBs and I'm interested in the sizes of the residues (number of atom per residue). I realized the number of atoms -len(residue.child_list) - differed from residues in different proteins even though being the same residue. For example: Residue 'LEU' having 8 atoms in one protein but having 19 in another!
My guess is an error in the PDB or in the PDBParser(), nevertheless the differences are huge!
For example in the case of the molecule 3OQ2:
r = model['B'][88]
r1 = model['B'][15] # residue at chain B position 15
In [287]: r.resname
Out[287]: 'VAL'
In [288]: r1.resname
Out[288]: 'VAL'
But
In [274]: len(r.child_list)
Out[274]: 16
In [276]: len(r1.child_list)
Out[276]: 7
So even within a single molecule there's difference in the number of atoms. I'd like to know if this is normal biologically, or if there's something wrong. Thank you.
strong text
I just looked at the PDB provided and the difference is really the fact that for the first VAL (88) there are atomic coordinates for Hydrogens (H) whereas for the other VAL (15) there isn't.
ATOM 2962 N VAL B 88 33.193 42.159 23.916 1.00 11.01 N
ANISOU 2962 N VAL B 88 1516 955 1712 56 -227 -128 N
ATOM 2963 CA VAL B 88 33.755 43.168 24.800 1.00 12.28 C
ANISOU 2963 CA VAL B 88 1782 1585 1298 356 -14 286 C
ATOM 2964 C VAL B 88 35.255 43.284 24.530 1.00 12.91 C
ANISOU 2964 C VAL B 88 1661 1672 1573 -249 0 -435 C
ATOM 2965 O VAL B 88 35.961 42.283 24.451 1.00 14.78 O
ANISOU 2965 O VAL B 88 1897 1264 2453 30 -293 21 O
ATOM 2966 CB VAL B 88 33.524 42.841 26.286 1.00 12.81 C
ANISOU 2966 CB VAL B 88 1768 1352 1747 -50 -221 -304 C
ATOM 2967 CG1 VAL B 88 34.166 43.892 27.160 1.00 16.03 C
ANISOU 2967 CG1 VAL B 88 2292 1980 1819 -147 73 -8 C
ATOM 2968 CG2 VAL B 88 32.020 42.727 26.586 1.00 17.67 C
ANISOU 2968 CG2 VAL B 88 2210 2728 1774 -363 -401 83 C
ATOM 2969 H VAL B 88 33.642 41.425 23.899 1.00 13.21 H
ATOM 2970 HA VAL B 88 33.340 44.035 24.608 1.00 14.73 H
ATOM 2971 HB VAL B 88 33.941 41.979 26.492 1.00 15.37 H
ATOM 2972 HG11 VAL B 88 34.011 43.670 28.081 1.00 19.23 H
ATOM 2973 HG12 VAL B 88 35.110 43.912 26.983 1.00 19.23 H
ATOM 2974 HG13 VAL B 88 33.777 44.746 26.959 1.00 19.23 H
ATOM 2975 HG21 VAL B 88 31.902 42.523 27.516 1.00 21.20 H
ATOM 2976 HG22 VAL B 88 31.596 43.562 26.377 1.00 21.20 H
ATOM 2977 HG23 VAL B 88 31.647 42.026 26.047 1.00 21.20 H
I would go about filtering out these atoms for every residue in analysis. Then you should almost always get the same number of atoms. As someone mentioned the other thing you have to consider is what Biopython call 'disordered residues'. These are residues for which you have more than one alternative location for the atoms in the crystal lattice (they call this 'altloc'). Sorting this out should solve your problem.
Let me know if you need help with filtering out these atoms.
Fábio

Resources