SQL Report Builder Column Group Merge Columns - sql-server

I have a basic report with a one Dataset and one column group.
When I run the report, the column groups shows all the columns I want to see as expected. However, some of the columns, I need to be merged.
For example, I have these columns that all show up, but need to merge to a single column Visa, then report shows the transaction amounts.
Visa Sign, Visa PIN, Visa Tap
How would I merge these columns and rename the main column to just Visa?
My first approach was the modify the dataset query and change anything the payment type to "Visa", but it turns out I can't use update statements since the raw data is still needed for another report.
Next, I tried using Lookups to find anything with "Visa%" and display the the data, but I still can't get the other columns merged to 1.
Any ideas would be great!

Related

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.

Use binary data column to create relationship in Power BI desktop

I have imported 2 tables from SQL Server to Power BI desktop in which each table contain one column having binary data. And these columns are used to create the relationship between that two tables.
When I proceed to create the relationship in Power BI these columns are not visible. I also tried the conversion of that binary column to text and try to create the relationship but it shows an error: Can´t create a relationship between two columns because one of the columns must have the unique value.
How can I create the relationship in Power BI desktop using Binary data columns?
As TDP stated, there has to be duplicate values, whether or not it is through an error in your data source. Please review the query editor and enable viewing column distribution and check to see if there are duplicate values in either of the columns you wish to use.
You will either need to modify your data source or make the changes within query editor directly to remove these duplicates.
It should not matter what data type you are using (binary/text) if there are duplicates. You will not be able to stop duplicates occurring just by changing the datatype.
EDIT: Oops, old thread. The answer still applies, please remove if unnecessary.
Can´t create a relationship between two columns
because one of the columns must have the unique value
This is your issue. One end of the relationship must have a distinct set of values.
Once you converted binary to text you would have been able to create the relationship if you had a distinct set on one side.
This isn't to do with binary being converted to text.

SSRS - Group Columns Together

All:
I have the following data (see Raw Data attachment). Inside my SSRS Report, I have a column for "Name / Stream / Offer One / Offer Two" (Name is the column for the "Value" column shown in the image).
I need my SSRS Report to display one row of the "totals" for each Name. Then under this, I need a row for each Stream associated with the Name that displays the values for that stream.
For the SSRS Output (please see second screen shot). The data loads into my tablix, but I need one row for "BAG-CV" that displays the total for that Name. Then under this row, I need a row for "AR" stream with the data for.
If you see Name: JAC-FL, it has 5 streams listed under it. So I would need one row for the total of JAC-FL, then 5 rows under it listing all the streams associated with this name.
Hopefully this makes sense.
The concept that you are describing is a nested parent/child group (two levels of grouping in a single table). This is quite easy to do and I'll walk you through the steps for your particular scenario thanks to the helpful description and screenshots that you posted.
Create table: I would advise always starting with the innermost grouping and building the table outwards. In your case, the lowest data granularity is Stream/Offer1/Offer2 as these are displayed as raw details with no aggregation:
Add Parent Group For "Name": Click on the group at the bottom (or in the table) and add a parent group to the current table details group, making sure to include a group header (for the sum):
Screenshot #1:
Screenshot #2:
Add Fields: Add the additional fields to your table, ensuring that the middle row is using SUM aggregation as per the screenshot:
Results: You should see the additional header row on the parent group with the desired SUM.
Cleanup: The example above just creates the most basic and bare functionality. I would suggest cleaning it up and adding a visibility toggle on the details group:
PS. I realize you probably aren't in control of the database schema, but wow, exclamation marks in column names would drive me up the wall :)

Summing the Non-Null results in a matrix

I have a report that looks like the picture below. It is a matrix with person name on the rows and weeknum on the columns. What I need to calculate is the number of weeks that have data in the calls taken column. In the picture below it is the consistency column with the red numbers. I can't seem to get those red numbers to appear. Is there an expression that can count the number of columns that aren't null in a particular matrix. This report will be dynamically generated and the number of weeks will be totally different each time.
I would rather solve this in SSRS because I don't want to mess with my SQL too much but if no SSRS solution is possible I can post my SQL and perhaps solve it that way.
You need to create a column group outside of the last group. So in your example, Right click on the column tab above your efficiency column in the 23rd week. After you create this column, you can use a simple Count(Fields!CallsTaken.Value) in an expression to count the times there are values listed.
Reference SO question on Horizontal Totals.

Creating a Batch Report

I am trying to create a batch report of multiple invoices using SSRS 2008 R2.
I have created the initial invoice report and have it set up with a parameter; the parameter uses an InvoiceID to populate the data within the invoice report.
I have created another report using lists, inside the list contains the information that was in my original invoice report but using a different parameter (BatchID). The problem I am running into with this is that instead of creating a single invoice for each invoiceID it is creating an invoice for each line item within each invoice. i.e.~ Instead of incorporating multiple items based on the InvoiceID (as the original report did) it is creating a report for each of the items.
What would be the best way of running a batch of these invoices? Am I going about this the wrong way or am I on the right track but missing something?
Thanks in advance!
SELECT i.InvoiceId, i.InvoiceNumber, i.BillTo_Line1, i.BillTo_Line2, i.BillTo_City, i.BillTo_StateOrProvince, i.BillTo_PostalCode, i.CustomerIdName,
i.ce_OutstandingBalance, i.ce_BillToDate, i.ce_BillFromDate, i.TotalAmount, id.ProductIdName, id.ce_customeridName, id.ce_CustomerProductName,
id.InvoiceDetailId, id.BaseAmount, id.PricePerUnit, id.ce_rate
FROM
Invoice AS i RIGHT OUTER JOIN
InvoiceDetail AS id ON i.InvoiceId = id.InvoiceId
Once I enter the invoiceID I get my report
My intent is to be able to run the report against multiple invoicesid numbers without having to select the invoice number itself. I have another table that collects the invoiceid's based on a batchid that they are run in.
So far I have attempted to create a subreport with the original report and Create a separate report that uses a list and attempt to group by InvoiceID for each batchid. Though with each of these I have so far been unsuccessful.
I am new to SSRS and have been pouring over documentation from MSDN about SSRS and the different abilities.
For this sort of repeating list, it's a matter of understanding how a list/grouping works.
Lists, Tables and Matrixes are all the same underlying object - the Tablix.
A List is a Tablix with one detail row (i.e. one Tablix row for each row in the Dataset), one textbox in that row, and a Rectangle in that textbox. The Rectangle can have various embedded elements like more textboxes and as such provides a repeating free-form item for each row in the Dataset.
You can see this when you create a List in the designer:
I assume your report query takes a BatchID and returns a number of invoices and their invoice details. I've taken some liberties with your data and created a simplified sample Dataset:
You want the Rectangle to repeat for every InvoiceNo. Currently the Row Group has no grouping item - change this to InvoiceNo under the Group properties and expand the Rectangle as required.
You can start adding in elements such as textboxes for the Invoice level items, something like:
Note that the left side of the Tablix has changed from lines to a bracket - this is because a grouping item was added to the Row Group.
This will repeat once for each InvoiceNo. Now we want to add the line items - you can do this by dragging a new Table into the Rectangle. Since we have a Row Group in place this table will only display items in that group:
When run for the sample data, this gives an ugly but functional repeating invoice report:
This could be tidied up as required, and page groups inserted between Group items in the Group properties as required.
Hopefully this at least gives you a rough idea of how you might go about your task.

Resources