I have been tasked with creating a report that needs to display in chronological order, but within that report there is data from 2 sources that covers 2 different areas of business.
What I have been asked for, is when the type of business changes, the header row is repeated with the correct column headings for that type - i.e. :
Type 1 :
Order Ref / Sales Exec / Contract Term / Despatch Date / Agreement Type / Hardware ID
Type 2 :
Order Ref / Sale Type / Contract Term / Despatch Date / Start Date / Hardware ID
Also each header row should have a different background color by the type also (although I think I can do this already). Within the report the header row could be needed multiple times if the types flip from one to the other as the report traverses through the orders in date order.
I was first looking at adding a grouping by type, but that will interrupt the chronological flow of course.
Just to complicate matters there are different numbers of item columns for each type in reality, but I might have to just leave blanks where we have less columns for one type.
Or is there some way of having sub reports that are reporting for an "outer loop" of the actual order references?
It's almost like I need to construct the report in some sort of looped code.
How can I achieve this?
You can do this using table grouping. The outermost group would be by day and then within that you would group by type. Within that you can add a group that isn't grouped by anything so that it will list all the details depending on the number of records in the dataset. So the design would end up looking something like this:
This is how it looks when you run it.
Of course you can play around with how everything is organized, but the general structure should work for you. Or at least point you in the right direction.
Related
I've never done this for a matrix and it's going a little over my head. Trying to make a sales report, and I can do the matrix just fine. The part I'm having trouble with and I haven't been able to find a direct answer for through googling is how to get a specific value out of the matrix.
Here is a picture of it:
Report
What I need is on the far right where it says total at the top. There I need to do another break out (dynamically would be preferred but not required) the first Column would be %change of 2013 -> 2014. Then of course then next would be 2014 to 2015 and so on.
Here is the design view if it helps: Design View
So the sum total of the year compared to the year previous.
I was trying to use iif and max but I think i'm just confusing myself but the expression i have in there is:
=Sum(iif(Max(Fields!Year.Value)=Fields!Year.Value,Fields!glamt.Value,1))
Just from my testing I got no idea what values it's pulling for that.
Something I've used before is to create a variable of the SUM of previous period, in you case year. So =SUM(IIF(Fields!Year.Value = "2017",Fields!glamt.Value,0) added into the Variables section of the report.
Then in a new column within the year grouping, you add your comparison formula;
=(SUM(glamt)-Variables!sum2017.Value) / Variables!sum2017.Value * 100.00
This gives you the percentage upshift/downshift, but you get the idea if you want the actual figure of increase/decrease in sales etc.
One of the downsides of this approach is that the variables will need to be added manually and you may have a large number depending on the number of previous periods you want to compare but should suffice for say the last 5 years.
I have been using SSRS off and on since SQL Server 2008. There are a number of typical SSRS pitfalls and gotchas. One of these I need to go over with some one.
This should be pretty easy for an experienced SSRS resource / expert.
Let me explain the scenario
I have an Invoice Header and Detail. The header contains the Invoice number and InvID. The INVID is the link column for the Invoice detail or the FK in the Invoice detail. I guess that must be pretty obvious to all.
Now I need a simple report that displays Invoices and their items.
For some reasons I do not want to use the Invoice number to group the invoices in the report. I want to use the INVID.
But I want to hide the value of the INVID and display only the invoice number.
In other words the report should look something like follows
Invoice Number Date / Descriptio Qty Rate Tax Amount
11001 12/52016
Item No 1 10 10 2 102
Item No 2 20 10 2 202
So on and so forth....
I know this is very easy. Any inputs would be welcome...
Plus any good recommendations in terms of resources for refreshing my knowledge of SSRS
Regards
With SSRS you have the flexibility to set the grouping conditions independently of what is displayed in the table. As the others mentioned, add a Row Parent Group by INVID. The group properties should look like this:
The basic table layout should look something like this:
So the outer group will repeat for each individual, but display the invoice number. The inner group will repeat for each applicable item.
This should point you in the right direction. I'm not sure of a good resource to direct you to. For me, trial and error has been the most helpful.
All you need to do is bring InvId in in main dataset which you are using in main Tablix, on Tablix you can apply grouping on any field of dataset.
We're trying to create a template date prompt to be used across multiple universes, and also be used against multiple date fields (for instance, Transaction Date, Invoice Date, etc)
The prompt should display a list of values like the below (there's about 30 total):
Date Range START_DATE END_DATE
-------------------- ------------------------------ --------------
D: Yesterday 12/02/2015 12/03/2015
M: Month Before Last 10/01/2015 10/31/2015
M: Month to Date 12/01/2015 12/02/2015
Our initial attempt at this (creating a derived table, and then some aliases against the derived table, with one alias for each date type such as Transaction Date, Invoice Date, etc) was a failure - the sql generated is wrong, and includes the sql that's just supposed to provide the list of values. I think we need to use a different approach entirely.
Thanks for reading so far. I would greatly appreciate any ideas! Feel free to ask questions and I'll edit my notes to answer.
EDIT - we're using UNV (legacy Universe Design tool)
I'm going to assume you have an existing (dimension) table that contains a record for each date and the necessary columns to hold the different representations. You can also create a derived table for this.
Here are the steps to achieve what you described (sorry, no screenshots, this is off the top of my head):
Create the required dimension objects (based on your date table) in a separate class in the universe (you can hide this class at the end; the end user shouldn't see them).
Take one of the date dimension objects (e.g. Transaction Date, Invoice Date. …), enable the LOV option and edit it (which should bring up the query panel).
In the query panel, select all the dimension objects, created in step 1, that you want to show in your LOV. Important: the object holding the value to be returned, should be placed first in the query panel. Run the query (nothing will appear though).
Make sure that you enable the option to Export the LOV, otherwise your customisations will be lost upon exporting the universe. Optionally, enable the option to refresh the LOV each time the user calls it.
As you can't really define a single, reusable LOV in UDT that you can reference in different dimension objects, you'll have to perform this for each dimension object that you would want to have this LOV.
One way around this annoyance may to define the customised LOV once, note down the generated LOV name (about 8 alphanumeric characters long) and then replace the LOV name in the other dimensions with that LOV name. I'm can't guarantee that this will work though.
In contrast: with IDT you can define a customised LOV like this once (either in the Data Foundation Layer or the Business Layer), and then reference it as much as you want.
I want to create a query, according the some condition.
I have one program and one program has lot of packages. then package show according the condition that which package is assigned to contractor then it will show in one column. packages and amount will calculate in different column those package is assigned to contractor.
condition 1: if those packages is assigned to contractor. then this shows 1 in category column. and Stage of progress column shows Contract awarded.
then how many packages is assigned to contractor then will show in the Numbers. if contractor is not award then it goes to second condition.
Condition 2: some package is assigned to Bid Under Price Evaluation then show in one column and amount will also show in one column.
Condition 3: some package is assigned to Bid Under Technical Evaluation then show in one column and amount will also show in one column.
In second condition you did get the date then it goes to third condition and check there is technical date or not and that package will show in 3 category.
There is some formula on conversion rate.
Tables Name
tblPrograms (vsSysProgramId)
tblProgramsAndPackages (vsSysProgramId, iPackage)
tblPackages (iPackageId)
tblPkgContractAwardDetails (iPackageId, iCurrency)
tblCurrencies (iCurrencyId)
tblPkgDPRBidSubmissionDetails (iPackage, dtCEAgreement(date Column)
Example:
1.Stage of progress 2.Category 3.No 4.Packages 5.Amount(INR) 6.Amount(Jpy) 7.Amount(USD) 8.%Progress
Contracts Awarded I 2 Pac1,Pac2 100 50 200 Amount/totalamount
BidsUnderPrice II 2 Pac3,pac4 50 60 120
Total 4 150 110 320
It sounds like your problem is a mixture of determining the query or queries to use, and some rather complex report layout and formatting requirements.
Don't try to do both of these in T-SQL queries: you'll wind up with complex, slow queries that will be hard to understand and to debug, and even harder to enhance.
I assume that ultimately your data will be displayed somewhere, whether on a screen or on a report. My advice would be to use the features of your reporting tool or web page to evaluate your various conditions and determine what should be hidden or shown. Then, write queries, as simple as you can manage, to return the data needed for the conditions and for display.
T-SQL is not a report-writing tool, and it is not equipped to handle complex data formatting requirements. Those concerns are best left to tools like ASP.NET and SSRS, which can be as flexible as you need them to be in terms of layout, logic, and data formatting.
I'm currently working on writing report generators. For one report I need to do a breakdown by a given characteristic (supplier, logging user, language, etc which for each row includes the name of the characteristic I'm interested in, the number of items that match that characterastic, and the percentage of total items this figure represents. The first two aren't a problem, the third is.
For example, to get a breakdown by language I'd be using a query like this.
SELECT lang_id,
COUNT(IF(open=TRUE,1,NULL)) AS lang_total
FROM table
GROUP BY lang_id;
This gives me the number of items per language.
I can get the total number of items in the table and store it in a variable simply enough with a plain count.
SELECT #totalOpen:=COUNT(*) FROM table WHERE open = TRUE;
Now I want to add a third column, which is the figure in lang_total divided by the value in #totalOpen multiplied by 100 (in other words, the percentage of all items that fit the criteria). Something along the lines of the following:
This is the bit I'm having trouble with, as because as far as I can tell you can't use aggregate columns in calculations.
SELECT lang_id,
COUNT(IF(open=true,1,NULL)) AS lang_total
(lang_total/#totalOpen)*100 as lang_percent
FROM table
GROUP BY lang_id;
I'm sure that there must be a way of doing this in MySQL, but I've not been able to track it down. Can anyone help out with this?
I read this question now for the first time. I know that probably it's too late to be useful for you but I would have solved in this way.
select lang_id,
sum(if(open= true,1,0)) as lang_total,
coalesce(sum(if(open= true,1,null)) / #r,0) as percentage
from table,(select #r:=count(*) from table where open = TRUE) as t
group by lang_id;