SSRS MAtrix/Tablix - sql

I have a report in SSRS report builder 2008 that has a chart that is a definitive size. I would like to make the matrix table fit neatly under the report as it would in excel. However it expands way past the report. I have tried turning can grow can shrink to false did not work. I have tried putting a rectangle and placing the matrix in there with no success. I tried setting the size in the tablix properties but it extends or shrinks below based on the data in the tablix. The tablix is just 6 lines the top line is a expression for the date and then there is previous year previous cumulative current yeat and current year cumulative and receipts %to last year. i have included the expresssions I used in the tablix not that I think it is causing the issue Any help will be greatly appreciated
=Sum(Fields!ID2013_Inventory.Value)
=Sum(Fields!ID2013_Inventory.Value)
=RunningValue(Fields!ID2014_Inventory.Value,Sum,"RECEIPTS_IND_DEC")
=SUM(Fields!ID2014_Inventory.Value)/SUM(Fields!ID2013_Inventory.Value)

Sorry I didn't follow up your comment earlier, it's been busy here...
There is a sledgehammer approach to this that will work, not sure if there is a more elegant way but here goes.
Fist some basics...
Determine how wide your matrix needs to be, let's say 25cm
Let's assume you have a couple of columns on the left that are both fixed at 2cm each. That gives us 21cm to put our varying columns in.
For now assume we only have 28 days, so we need to set the column width of the column group to 0.75cm (21/28).
Test and make sure everything looks OK.
Now here's comes that sledgehammer!
Make another 3 copies of your matrix and adjust the column widths for the next three number of days (so 29,30 & 31).
Now set the visibility of the of each matrix so that it only shows when the related number of days are returned in the dataset.
I don't know what your dataset looks like so I can't give much advice on determining the number of days returned but I often create another dataset that gets the value, in your case something like
SELECT COUNT(DISTINCT MyDateColum) as DateCount FROM MyDates
Or I guess you could probably base visibility on the month and whether its a leap year or not.
Hope that helps, if any of it is unclear let me know and I'll try to get back a little quicker this time.

Related

VBA - Graph by month

I am having issues trying to create code to make a graph that is dependent upon months. So I have Column A which is the beginning of the week date, i.e. 1/1/17. In Column B I have the count from that week of issues occurred. I would like to group together the count by month, using the Month function, so for January there are 37 issues, February - 23, etc. And then make a graph accordingly where the first month is titled January.
Eventually, I would like to similarly do this on a quarterly basis as well, but any help with the monthly issue first would be greatly appreciated. Here is a screenshot of the data which is located in Worksheets("Report").
First off, format your data as a table since that will make your life much easier. You will need to add headers to each column. This will make your data easier to read, and easier to maintain.
To format it as a table highlight the range, and then press CTRL+T. Make sure to check 'My data has headers'.
Good, now click inside the table, Insert > PivotTable. Select the destination. For rows you want Date, for values you want Sum of Value (where value is whatever you name your values column.
Then finally, check out this article for the whole rundown of Groupby: http://www.contextures.com/xlPivot07.html.
To be fair, there is an easy enough way of doing this without a PivotTable (adding a helper column for Month for example), but there's no need to reinvent the wheel. Additionally, if you want to add Qtr. eventually, you're better off familiarizing yourself with workhorses of excel.
Lastly, once you have taken the above steps, you'll likely find the Timeline slicer very helpful. You can use that to visualize specific periods on your pivot or chart.
Minor Note: This all assumes your dates are true dates. If they aren't, you'll likely run into more issues.

Conditional cell formatting on SSRS pivot table

I created a pivot table in SQL that has report names along the left side, and hours (00:00, 00:01, etc.) along the top. The values in the table are the number of times each report has been used during that hour over the past three months. I've imported the table into SSRS, and I'm trying to create a heat map of sorts. I want to color the cells darker or lighter across the row based on the number in each cell compared to the value of cells across the row (cell that has the highest value will be the darkest colored).
I've tried following this guide to color the cells, but here the entire row is one field, while I have separate fields for each column. Is there a way to achieve this?
EDIT: Added picture of table design, and preview where coloring is done incorrectly
I understand your problem better now...The function uses the min and max values of a column to determine the range from lightest to darkest, then it probably looks at what fraction of the range your actual value is. In your case where you have each column's data coming from a different cell it'll be a pain unless your columns are fixed and even then it's more trouble than it needs to be.
I would suggest the following.
DON'T PIVOT your data in SQL, we can do that really easily in SSRS, your dataset will be simpler too something like
ReportName Hour UsageCount
ReportA 0 8
ReportA 1 4
ReportC 22 18
and so on...
Create a new report and add a matrix with reportName as the row group and hour as the column group. The data values will be UsageCount.
That's it for the report design, then just set the cells back ground based on your function but this time you can pass in Max(Fields!UsageCount.Value) etc as per the sample.
I've rushed this a bit so it if not clear, let me know and I'll post a clearer solution.

Get excel to create groups of data based on cell values

I have a question that has me stumped. I feel like I am very close to the answer, but cant ever create an adequate solution. I have tried nested IF statements, incorporating the AND function, incorporating the OR function, and I cant come up with something robust enough to answer this question
Here is my question
I am creating a program that automatically analyzes a stock using a oscillator equation. The results of these equations (in theory) predict how the stock will perform over the near term.
In this equations formula, a stock is considered underbought if the calculated oscillator is below 30 and overbought if it is above 80. I would like to group the cells by the contents of the calculated oscillator value.
The beginning of the period starts with the first instance of a value at or below 30 following the previous occurrence of a value at or over 80.
The period is closed with the first occurrence of a value at or over 80 occurring after the previously identified =<30 value.
There will be times that a value doesn't fit in to a period. For example, a value of 50 sandwiched between the end of the last period and the beginning of the next period will not have a group.
I have attached 2 pictures.
The first picture is a example of what the data could look like. The %D column is the calculated oscillator result. It is important to note that I would like to extend this solution to multiple stocks each having varying data. I will be using it to analyze stocks over varying times (say a 6 month period or a 12 month period). Therefore, the solution needs to be dynamic enough to fit varying amounts of cells and different distributions of data.
The second picture is a example of what I would like the result to look like. I have added a comments section to explain the reasoning behind the grouping in case my description above didn't make sense.
Image 1
Image 2
Please let me know if I can clarify anything for you. Any ideas or assistance is GREATLY appreciated
Put this in B2 and copy down:
=IF(AND(NOT(ISNUMBER(B1)),A2<=30),MAX($B$1:B1)+1,IF(MAX($B$1:B1)=0,"",IF(AND(ISNUMBER(B1),A1>=80),"",B1)))

Writing a VBA makro to sum a nested bill of materials

Hi I have looked around extensively on the web but have not been able to find a way to calculate a nested table of totals.
My data is pictured below.
What I am looking for is a way to add up all of the sub items of an item and put that total in the cost of the original item.
so for instance the total of line 6 will be the sum of lines 7,8,9, and 10. but the total of line 2 will be the totals of lines 5,6,11, and 12 each of which needs to be seperatly subtotalled.
I have tried excels subtotal function, but it is clumsy and not a generalised solution. I may need to add or subtract components over time and have the totals calculated again.
I have tried a few if then and for loop combinations, as well as an attempt at a function that calls itsself, with very limited success.
I think I have a block in how to approach this, as well as some programming knowledge gaps, like can a function call its self, and if it does, will it automatically create an independant set of function instance variables, or will the new call overwrite the old instances variables.
Any help with methodology and knowledge would be great.
Thanks
Does this formula work for you? In a new column, say E, starting in E3 and copied down:
=SUM(IF(LEFT(B3:B$999,LEN(B3))=B3,D3:D$999,0))
Here 999 is a dummy last row --- change it to suit your situation.
Columns B and D are assumed to hold Outline and Bom Cost, respectively. The logic is: sum up all rows below (and including) the current row if and only if Outline starts like the current row's Outline. So if Outline in the current row is 1.2.3 it sums up all Bom Costs found below where Outline start with 1.2.3 (1.2.3.1, 1.2.3.2, 1.2.3.2.1, etc.).
This formula assumes that the outline is properly ordered.
It is also assumed that the Outline values are text. If they are not, the formula above will fail when Outline is a whole number (1, 2, ...). This longer formula converts whole numbers to text and should work:
=SUM(IF(LEFT(B3:B$999,LEN(B3))=IF(LEN(SUBSTITUTE(B3,".",""))<LEN(B3),B3,TEXT(B3,"0")),D3:D$999,0))
Hope this helps.

Netsuite - Saved Search with Days Calculation Formula

![enter image description here][1]I am trying to create a Saved Search in Netsuite that calculates the number of days between two dates in a summarized search. I am attaching a screenshot of the Results tab for reference. I have tried using a Numeric Formula field, as well as a Date/Time Formula field. I have also tried every Summary Type available. Is there another way to do this? I just get an entire blank column when I run this.
As some background, I am trying to calculate how many days between when the system note was changed to Pending Accounting to when the system note was changed to Processed.
Thanks!
Update: It won't let me upload photos. Here is the formula I am using:
(CASE WHEN {systemnotes.newvalue}
= 'Processed'THEN {systemnotes.date} END)-(CASE WHEN {systemnotes.newvalue}
='Pending Accounting'THEN {systemnotes.date} END)
I'm not sure you are going to be able to evaluate this.
systemnotes.value can only have one value at each cell, which means that you can't have it be equal to Processed and Pending Accounting at the same time.
What you do in this case is something along the lines of
CASE WHEN {systemnotes.newvalue}= 'Processed'
THEN TO_DATE({systemnotes.date})
ELSEIF {systemnotes.newvalue}='Pending Accounting'
THEN TO_DATE({systemnotes.date})*-1
ELSE 0
END
And then do a sum on the whole thing. I'm pretty sure this won't work as this is not tested, but the idea is to declare on each cell the positive, negative or null value, and then add make NS add the whole column to summarise.
Also you might find issues for duplicate values so if the state goes back to a previous state you might get weird results.
Edit- see if you can find something to work with unix time, that might make life easier.
See reference for oracle sql: http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions001.htm