Report with 2 datasets and column groups - sql-server

I need to create a report that is using 2 datasets. One (yellow) is bringing product data, the other (green) is bringing company and quantity data. They can both be linked using a unique ID field.
One product may be used by up to 8 organisations and each organisation may have multiple departments.
Can someone explain how I can build a report to give the excel output as shown in the image.
I am familiar with lookup in SSRS, but not sure how to use this where groupings are required from the second dataset.

Related

Crystal Reports: passing calculated data through parameter to subreport

This is my first time working with subreports, but I have about 6 months of Crystal experience.
I am constructing a daily report for sales managers, where they can get a summary of each of their salespeople's activity (open orders, quotes, etc.). This report already exists as an individual sales report, where they get more details on their activity, so I'm using a summarized copy of that report as a subreport for the new Manager version.
My issue is
generating the list of salespeople under the sales manager, eg:
"if parameter = managercode then select salesperson where salesperson_managercode = managercode"
Getting stuck on this logic, can't seem to crack it.
passing the above list through the subreport, one at a time. Essentially a loop. From there I want to total everything to provide a Team Total at the bottom.
Any help is appreciated!!
You shouldn't need to worry about the looping structure. The report will take care of that for you. If you have a dataset where each row represents 1 manager, then placing your subreport within a section that repeats for each record in the dataset will allow the subreport to effectively loop through each record in the dataset.
The employees who are supervised by each manager can then be selected by using the "link" between the main report and the subreport. A "link" is defined in your subreport's setup by declaring a field from the database in the main report and a field within the database of the subreport. The field in the subreport should be a Foreign Key that corresponds to the field in the main report. Following the example of managers and employees, your main report would have a dataset the represents Managers. This dataset should have a primary key such as Manager_ID. Then your subreport that represents the Employees would have a dataset that contains columns such as Employee_ID as a Primary Key that is unique for each employee, as well as a foreign key such as Manager_ID that indicates which manager is responsible for the given employee. When linking the subreport and main report you will want to use Manager_ID as the "link" between them.
I hope this helps, or at least helps you get started!

How to manipulate dataset to get information from different tables?

Currently my data is set up as a union of two tables. The red rows are Table 1 and the blue rows are Table 2. I am doing my union in SQL Server and am connecting this into Tableau. I am using Excel right now to depict what I am seeing (left pivot table) more easily and what I want to see (right made-up pivot table).
The current pivot table is showing when filtered on a particular Plant/Project/Product, those are the components that go into the Product and those are the months in which the Products are due to the customer. The values in the bottom row are the quantity of the Product that is due to the customer. For example- in June, a quantity of 1 of the 150-100020-1000 product is due to the customer. The quantities are showing up under a null component because that field isn’t in Table 2, as you can see in the blue rows.
I want those bottom row values to appear under literally any one of those components that are listed. In this case, it’s only showing one set of Plant/Project/Product, but I would want the formula/code to pick up on that too when it’s evaluating what to output. In the example on the right side made-up pivot table, I have the quantities showing up under the component #100, but it can be under any of them as long as the Plant/Project/Product is equal in both tables. I also don't want the blank/null dates from Table 1 to show up, but they are tied to the components so I can't filter them out easily.
I've tried several types of joins and temporarily tables to get this working and keep coming up blank. How can I set up my dataset to get the view I want to see in Tableau?
Dataset and Current View + View I Want
Your problem is you don't have a Component against a Qty. Hence for what you want somehow you need to create a Component. Perhaps this is possible using a FIXED calc, which would create this field across all records. If the value of Component doesn't matter create this calculation:
{MIN([Component])}
This should put 100 against each record.
If you also need to keep the existing Component value, when it exists, try a formula such as:
IFNULL([Component],{MIN([Component])})
Note I haven't tested any of this.

Salesforce Reports: Condense multiselect values to one line

I am working within a Salesforce report where I list the organization name in one column and the organizational types in the other. Some organizations only have one org type and as such would only have one record/line in the report. Other organizations have two or more organization types and appear multiple times in the report (one line for each org type). Is there a way within Reports in Lighting in cases where more than one org type exists to condense/concatenate them all in one cell so that the record only appears once?
Have you considered Matrix report where rows would be grouped by org and column would be types (type names?). Cells on intersection would contain 0 or 1, looks bit weak but would get the job done.
Other than that you might be looking into some config (analytic snapshot?) or maybe even code to kind of rollup types by org into 1 helper field on org. And what would that be evem, test field? mutlipicklist? Doable, sometimes needed but bit messy. You'd need to rollup on insert, update, delete, undelete (restore from recycle bin, ideally you'd cover that scenario too even though there's no bin in lightning yet)

NetSuite - UNION ALL equivalent in saved search?

I'm in the process of writing a SuiteTalk integration, and I've hit an interesting data transformation issue. In the target system, we have a sort of notes table which has a category column and then the notes column. Data going into that table from NetSuite could be several different fields on a single entity in NetSuite terms, but several records of different categories in our terms.
If you take the example of a Sales Order, you might have two text fields that we need to bring across as notes. For each of those fields I need to create a row, with both the notes field in the same column but separate rows. This would allow me to add a dynamic column that give the category for each of those fields.
So instead of
SO number notes 1 notes 2
SO1234567 some text1 some text2
You’d get
SO Number Category Text
SO1234567 category 1 some text1
SO1234567 category 2 some text2
The two problems I’m really trying to solve here are:
Where can I store the category name? It can’t be the field name in NetSuite. It needs to be configurable per customer as the number of notes fields in each record type might vary across implementations. This is currently my main blocker.
Performance – I could create a saved search for each type of note, and bring one row across each time, but that’s not really an acceptable performance hit if I can do it all in one call.
I use Saved Searches in NetSuite to provide a configurable way of filtering the data to import into the target system.
If I were writing a SQL query, i would use the UNION clause, with the first column being a dynamic column denoting the category and the second column being the actual data field from NetSuite. My ideal would be if I could somehow do a similar thing either as a single saved search, or as one saved search per entity, without having to create any additional fields within NetSuite itself, so that from the SuiteTalk side I can just query the search and pull in the data.
As a temporary kludge, I now have multiple saved searches in NetSuite, one per category, and within the ID of the saved search I expect the category name and an indicator of the record type. I then have a parent search which gives me the searches for that record type - it's very clunky, and ultimately results in far too many round trips for me to be satisfied.
Any idea if something like this is at all possible?? Or if not, is there a way of solving this without hard-coding the category values in the front end? Even if I can bring back multiple recordsets in one call, that would be a performance enhancement.
I've asked the same question on the NetSuite forums but to no avail.
Thanks
At first read it sounds like you are trying to query a set of fields from entities. The fields may be custom fields or built in fields. Can you not just query the entities where your saved search has all the potential category columns and then transform the received data into categories?
Otherwise please provide more specifics in Netsuite terms about what you are trying to do.

SQL Views Multiple Line Entries

I have an interesting one that I have searched for and can't find the solution to.
I am working with a developer who is trying to integrate our incident management tool into Palladium, a finance tool and we're stuck on being able to import invoices correctly.
Scenario
There is a view that contains the invoices but there's several elements to the invoice. The view here shows all the billing parts and includes value amounts for Products and Expenses but it doesn't show details of the products or expenses as there may be multiple line items in that invoice. There are 2 further views one containing the product information and one containing the expense information. There is a common field that can be used to reference the invoice in each of these views called Billing_Log_RecID.
Here's how the default invoice search view looks when exported. I've selected entries where there are products and/or expenses added.
What I need to do is display in a view a line item for each invoice but break out the multiple expense or product items into I guess separate columns so for example
Inv1 COMPANYNAME COMPANYID INVTOT PROD1 PVAL1 PROD2 PVAL2 etc EXP1 EVAL1 EXP2 EVAL2 etc, there's never likely to be more then 2-3 different items but to be safe 5 is a good number.
Here's an example of a query showing products attached to an invoice, I have highlighted where there are multiple lines.
The same exists for the expense items
Hope someone can help.
Dave

Resources