Cross tab summary fields don't restrict by column - crystal-reports

so I'm working with Crystal Reports 10 and was looking at the cross tab to try and have a nice and neat table of my information. I'm trying to make a report where for each item (as a row), the columns will be the different sizes it comes in and the value of that cell will be the quantity.
So something that looks like this:
Small | Medium | Large
Item 1 1 | 5 | 10
Item 2 5 | 10 | 15
Using the cross tab though, the quantity field I have has to be totalled, averaged, etc. so I can't get the specific breakdown for each size in a nice table like that. Is there any way to tweak the Cross Tab to do this or is there another tool in Crystal Reports that would let me have the quantities per size in that organized fashion?
Thanks for any help you guys can give.
Update:
The cross tab I have tried gives me something that looks like this
Small | Medium | Large
Item 1 16 | 16 | 16
Item 2 30 | 30 | 30
If I put the values in the details section as separate fields, I'm able to get the values to match up properly, but its not the right format. It comes out like this
Item 1 | Small | 1
Item 1 | Medium| 5
Item 1 | Large | 10

Create a Cross-tab
Add {table.size} to the Columns
Add {table.item} to the Rows
Add {table.quantity} to Summarized Fields

Related

Issue with displaying of information in a Tables/Matrix visual - Power BI

Hi I'm new to Power BI desktop, but have come across an issue when displaying information, Hopefully it's due to my lack of knowledge, but I can't seem to find a way to display values in rows one after the other similar to Pivot tables functionality.
For example so if I had the following table
Location | Salary | Number
A | 100 | 1
A | 200 | 2
B | 100 | 3
B | 400 | 4
C | 400 | 5
D | 800 | 6
What I'd like to produce is something like .....
A | B | C | D
300 | 500 | 400 | 800 <-- Salary Sum
3 | 7 | 5 | 6 <-- Number Sum
I have a direct link with my data source, please suggest a way to display the same with tables/matrix
Thank you in advance
Unfortunately this is currently not supported in Power BI, but maybe there is some light at the end of the tunnel... The Power BI team have started working on this much requested feature. See here
As Tom said, this is available with the August release. You can check which version you have by going to File -> Help -> About. If you have an older verion, you can go here to download the right one for you (32-bit vs 64-bit).
Once you have made sure you are running the August version, simply create a matrix with Location in the Columns field and Salary and Number in the Values field. Then go into the formatting pane and under Values, turn Show on rows to on.
Try this : Go to query editor, select the first column of the desired table, location in your case and from transform tab, select unpivot other columns.
That's it! Now go and drop your visual.

SSRS Matrix Grouping Vertically to keep headers in same column? Is it not possible?

using SSRS 2008 R2 here.
I've been able to get a similar layout to work with a regular tablix, where I get each group header to fall on top of each other in the same column by adding a row within that group, however I need to use a Matrix because of a dynamic column (month below). When I try to add another row, it only adds a row where the monthly data starts, not in the headers. So the headers stay in their each column. In trying to keep the example as easy as possible, I'm trying to do something like this (Store theme).
STORE NAME | MONTHS
STATE | SALES
TOWN(S) | SALES
which woudl look something like this in a Matrix
WALMART JAN FEB MARCH etc....
TEXAS | 3000 2000 6000
HOUSTON | 1000 500 2500
AUSTIN | 2000 1500 3500
I've only been able to produce something like this where each group is a seperate column:
STORE | STATE | CITY | JAN | FEB | MAR |
WALMART | TEXAS | HOUSTON | 1000 | 500 | 2500 |
| AUSTIN | 2000 | 1500 | 3500 |
Again, I've been able to get a regular Tablix formatted like this, but a Matrix I'm struggling with. Can anyone help me on how to do this? Thank you in advance!!
It is possible using a tablix/matrix and adding some special grouping settings.
Add a tablix with the City field in Row Groups pane:
Right click the City group, select Add Group / Parent Group. Choose State and set Add a Group Header
Delete the left most column (State column added in the previous step).
Note the group is still present.
Right click the STATE group and add a Parent Group as step 2. In this case choose STORENAME
Again delete the left most column (Store Name column added in the previous step)
You will get the following tablix.
Delete the first row
Set the Fields using the Row Group hierarchy order. STORENAME/STATE/CITY
Right click the first cell in the next column and add a group / Column Group / Parent Group. Choose MONTH in group by.
Delete the first row.
Set SUM(Fields!Sales.Value) in the next cells in the same column.
After these steps you will get a tablix like this in design window.
It should produce:
Let me know if this helps.

Calculate median and average in a partition in Tableau using table calculation

I have a details table of posts and subjects digged from a forum. Row is the single subject (ie postID and subjectIS is the primary key for the table), then I have some measures at subject level and some at post level. For example:
+---------+-------------+--------------+------------+--------------+--------+
| post.ID | post.Author | post.Replies | subject.ID | subject.Rank | year |
+---------+-------------+--------------+------------+--------------+--------+
| 1 | mike | 10 | movie | 4 | 1990 |
| 1 | mike | 10 | comics | 6 | 1990 |
| 2 | sarah | 0 | tv | 10 | 2001 |
| 3 | tom | 4 | tv | 10 | 2003 |
| 3 | tom | 4 | comics | 6 | 2003 |
| 4 | mike | 1 | movie | 4 | 2008 |
+---------+-------------+--------------+------------+--------------+--------+
I want to study the trend of posts and subjects by year and color it by subject.Rank.
Firsts are easily measured putting COUNTD(post.ID) and COUNTD(subject.ID) in rows and 'year' in column.
But if I drag MEDIAN(subject.Rank) in Color, I got a wrong result: it's not calculated at distinct subject.ID level but at row level.
I think I can accomplish it using table calculation features, but I have no idea on how to proceed.
It sounds like you are trying to treat Subject.Rank as a dimension, instead of as a measure. If so, just convert it to a dimension on the worksheet in question by right clicking on the field and choosing dimension. You can also convert it to a dimension in the data pane by dragging the field from the measures section up to the dimensions section. That will tell Tableau to treat that field as a dimension by default in the future.
A field can be treated a dimension in some cases, and a measure in others. Depends on what you are trying to achieve. If you are familiar with SQL, dimensions are used to partition data rows for aggregation using the GROUP BY clause.
Finally, count distinct (COUNTD) can be expensive on large datasets. Often, you can get the same result another way. So try to think of other approaches and save COUNTD for when you really need it.
Try using {fixed [1st LEVEL],[2nd level]: median()}
or
Table calculation approach
when you put in median there is an edit table calculation under advance compute using put you fields in there(Make sure its ordered the way you want it to calculate when you select them) then click OK select the at which level and restart every

Crystal Reports report formatting across different pages

I have a question about Crystal Report. I have an existing report, with its data taken from a stored procedure. The data may look like this:
Division|Group Level 1|Group Level 2 |Group Level 3|Value
--------+-------------+-------------------+-------------+--------
IT |Assets |Current Asset |Cash |100
CORP |Assets |Current Asset |Cash |200
IT |Assets |Current Asset |Receivables |300
CORP |Assets |Current Asset |Receivables |400
IT |Assets |Fixed Asset |Land |500
CORP |Assets |Fixed Asset |Land |600
IT |Liabilities |Current Liabilities|Wages |100
CORP |Liabilities |Current Liabilities|Wages |200
IT |Liabilities |Current Liabilities|Taxes |100
CORP |Liabilities |Current Liabilities|Taxes |100
IT |Liabilities |Long-Term |Bonds |300
CORP |Liabilities |Long-Term |Bonds |400
The actual data may have many more divisions (not just two). In the new report, I want the report to look like the following:
| IT | CORP
Current Asset
Cash | 100 | 200
Receivables | 300 | 400
Total Current Asset | 400 | 600
Fixed Asset
Land | 500 | 600
Total Fixed Asset | 500 | 600
Total Assets | 900 | 1200
Current Liabilities
Wages | 100 | 200
Taxes | 100 | 100
Total Current Liabilities | 200 | 300
Long-Term
Bonds | 300 | 400
Total Long-Term | 300 | 400
Total Liabilities | 500 | 700
So, the report will be expanded to the right, according to the number of divisions. Assume that one page can hold up to 10 divisions. Then if there 15 divisions, then the first page will show division 1 to 10, the second page will show 11 to 15. The items shown on the first and second page will be the same, just for different divisions. The number of divisions are flexible. And also the items are quite a lot (there can be a lot of current assets, liabilities, etc).
For now, I tried to do some formatting in the stored procedure, so the returned data will be like:
Page No | Group Level 1 | Group Level 2 | Group Level 3 | Div 1 | Value 1 | Div 2 | Value 2
--------+---------------+---------------+---------------+-------+---------+-------+--------
1 | Assets | Current Asset | Cash | IT | 100 | CORP | 200
1 | Assets | Current Asset | Receivables | IT | 300 | CORP | 400
and so on.
For division 11 to 15, I set the page no to be 2. And then in the Crystal Report, I will group by : Page No, Group Level 1, Group Level 2, and Group Level 3.
So the Crystal report will show everything on a page based on the page number.
The problem is that:
- If there are a lot of items, then it may not fit in one page as well. For example, assume one page it can fit up to 30 lines, then if I have 40 lines, the 10 lines will be shown in the second page.
But I want the second page to still show the first 30 items for division 11-15, and the third page will show the last 10 lines for division 1-10, and the fourth page will show the last 10 lines for division 11-15.
- The running total in Crystal Report will be reset on each change of the group. Let say I have 40 assets. Then after the 40 assets, which is on the third and the fourth page, it should show the total of the assets. How do I calculate the running total so that it shows up correctly? (Considering I can not just sum it up directly, as third and fourth page should show the total of different divisions).
Is there any solution for this problem or a better approach to format the data?
Thanks.
What is your exact issue?
Formatting the report or calculating running total?
Implement below process
Create a group with "Grouplevle1", Don't supress Group1 Header
Create a group with "Grouplevel2", Don't supress Group2 Header. Create two text filds and write "IT" and "Corp" and place on report
Create a group with "Grouplevel3", Now supress the group3 header
Write a formula and add below code
If Divison="IT"
Then Value
Else o
wirte another formula and add below code
IF Divison="Corp"
Then value
Else 0
Place both forumula in detail and add summary to all sections.Also supress detail section
For all group footers write required text
This will solve your problem.
I would recommend using a cross-tab.
Settings:
Columns: Division
Rows: Group Level 1, Group Level 2, Group Level 3
Summarized Fields: Value
You'll have to experiment with the row-grouping fields to get the correct spacing. Do the same for the column's sizing.
In general, this is how I finally solve the problem:
1. Define how many divisions (NumColumn) to be displayed in a single page.
2. Create a table to store the mapping of the division. The table has column that stores PageOffset and ColumnNo. PageOffset stores the number of page to be added when displaying a particular division. For example, if there are 15 divisions, and a page can only accommodate 10 divisions, then the first 10 divisions will have `PageOffset = 0` and the last 5 divisions will have `PageOffset = 1`. The ColumnNo is the position of a division in the report column. So first division will have value of 1, second division will have value of 2 and so on. 11th division will have the value of 1, etc.
3. Create a result table. For each column in the report, we have 2 database field, value and total.
4. Loop for each record, sorted by the group.
Select the position of the division from the table in step 2. If `ColumnNo = 1` insert a row in the result table. E.g. for division 1 and 11 it will create rows in result table.
After that update the row data, based on the position of the division. So for division 1-10 will update the row created by division 1, division 11-15 will update row created by division 11.
5. Count the number of items in each group and store it into a table.
6. Define how many rows (RowsInPage) to be displayed in a single page.
7. Set PageAdd = 0 and RowsLeft = RowsInPage
8. Loop for each group
Retrieve the number of rows needed for this group
Add the page number of each row with PageAdd
Decrement RowsLeft
If RowsLeft = 0
Increment PageAdd
Set RowsLeft = RowsInPage
End If
9. Loop for each group
Loop from 1 to NumColumn
Update the total field for each division. This total field value will be put in the report as the running group total for that particular division.

SSRS - show row total in column

I am working on SSRS 2008.
I have a report as follows, I want the toal of Amount in Total column. I am not able to get total in column. I have tried Add Total / Sum() features of SSRS but no luck.
+---------+-------+--------+-------+
|Supplier | Agent | Amount | Total |
+---------+-------+--------+-------+
| | A10051| 237.2 | |
|S2005068 +-------+--------+ |
| |A10052 | 23.8 | |
+---------+-------+--------+-------+
I think your design is not proper. The total row in the last column will be under the details group. If you want a total on the last column you can get but for-each row it will repeat. use
=Sum(Fields!Amount.Value,"Supplier") here Supplier is the "Group Name"
To avoid this repeatition we need to add the total column inside the supplier group and use =Sum(Fields!Amount.Value) for total
or
Right click on the Amount column data -> Add Total -> Before or After. This will display the sub-total for the Supplier group in the same Amount column after/before as you selected.
Add total on the supplier group, add it before or after, depending if you want it on top or bottom. SSRS will fill in =SUM(Fields!Amount.Value) and show the total 268 below.
To make a Total Rows =countRows("dataset")