SSRS How to "Unpivot" my pivotted table - sql-server

I have an SSRS sub report that is dynamically retrieving from different tables based on auctioning different cells. In order to do this, I pivot the tables at the sql server end using dynamic sql in a procedure.
When it gets into SSRS it obviously looks like this.
Field Value
Product Dining Table
Length 1.2m
Width 1m
Height 0.9m
Colour Brown
Product Bench
Length 2m
Width .4m
Height 0.6m
Colour White
Is there a clever way to "unpivot" the table in SSRS so that I get it like so.
Product Length Width Height Colour
Dining Table 1.2m 1m 0.9m Brown
Bench 2m .4m 0.6m White
I've tried using a matrix but I can't figure out a way to do it.
Thanks.

Here only thing missing is to get unique ID along with SQL result set, then that field is used in Row Grouping.
You can refer to similar post Add the columns automatically in SSRS report posted by me

Related

Keep duplicate data in matrix visual Power BI

I'm facing an issue and hope you'll be able to help me.
I have a matrix with a lot of data and I've noticed that if a line have two same rows, Power BI brings them together immediately and sum the numbers.
Do you think that it's possible to tell Power BI do not summarize any row of the matrix?
Thank you.
Sample Screenshot:
The Power BI Matrix behaves similarly to the Excel Pivot Table, in which the aggregated data in the Values area is filtered by rows and columns: Double filter entries make little sense. However, this can be circumvented with a little workaround.
In PowerQuery select your table and add an index column via Add Column - Index Column
In the Power BI report view add this new index column to the Rows field of your matrix
In the formatting pane disable Word wrap for the Column headers and hide the index column by pulling the column width of the index column with the mouse to zero.
You can play around with the position of the index column to what looks best.
But as can be seen, this removes the aggregation in the Values area too.

Finding difference between columns in column group

I am using report builder to create a report showing a budget for a project. The dataset includes line items for both budget and projected. See below for example rows. I am using a matrix with column group to display budget and projected side by side as well as a row group to show section, category, etc. I need to have a variance column that subtracts projected from budget.
I have scoured the interwebs for solutions but nothing that has worked so far. I feel like there has to be simple solution to this given it is something that could be done in a sql query with zero effort. Most solutions are assuming I have two separate fields, but these are dynamic fields pull out with the column group.
Dataset Row Samples
Type Section Cateogry Phase Task Total
Budget Building Kitchen Pre-Construction Cabinet Hardware $100
Projected Building Kitchen Pre-Construction Cabinet Hardware $220
Report sample
COL GROUP This is the column i want
Budget Projected Variance
+Buidling $100 $220 -$120
+Kitchen
+Pre-Con
EDIT: I tried the below solution without success and have already visited every link provided in the second answer. Maybe there is something I am missing, but I ended up just doing everything in the SQL query and not use Column groups. This is 100% the simplest solution. I am very surprised there is no easy way to reference individual columns in a column group. The below may work for others, but I just could not get them to work for me. Not sure why.
You could add an additional column inside the “Type” group (provided that this is the name of your column group). Set the Column Visibility to hide the column by an expression like
= IsNothing(Previous(Field!Type.Value, “Type”)
Calculate the values for that column as
= Previous(Sum(Fields!Total.Value), “Type”) – Sum(Fields!Total.Value)
That should calculate the difference between the values of the previous type and the current type, and
only show that column for the "Projected" type (when there is a previous type).
On the matrix, you can use the group subtotals to achieve this, you only have to overwrite the SUM operation with an expression that subtract to values. There are many link mentioning how to do that or that can helps you:
How to add calculated column from dynamic columns to a matrix
Adding subtotals to SSRS report tablix
How to write Expression to subtract row Group SubTotals
Reporting in SQL Server – Using calculated Expressions within reports

Displaying ready pivoted data in a graph - SQL Server Data Tools/BIDS

I have some ready pivoted data in SSRS that I wish to display as a graph, i.e. I have 13 columns (product and then one column for each month) and a values row below.
Because the data is 'pre pivoted' into columns rather than rows I'm struggling create a graph that displays as it would in excel, i.e. because each month is a column/field they are effectively different series in the graph, therefore the horizontal axis isn't as months, they are displaying as numbers (the chart data bars are fine).
Has anyone got any ideas with regards to how I could fix this?
Thanks
Jamie
Is this not what you want? Change the axis around using the series properties

Crystal Report cross-tab report - getting the total for static columns

I have a dataset getting from SQL server SP like below.
I need to put it in a cross tab report as I need to display the values in the category column as rows in the report.
Below is the format of the report I need.
Also I need to get the totals of all the rows in the report. I manage to get totals for dynamics columns but not for the Static columns (LastMonthSales and MarketReturn).
I used formula field, I can get the total but not in the same line as the other totals.
Crystal report Cross Tab tools only accept:
1. One specific Column.
2. One Specific Row.
It cant be done with multiple different columns which is the other
column is came from rows. Best thing you have to do is to Pivot your
query to fit your needs.
Try to figure out this link

SSRS mailing labels with images

i want to be able to display a grid of business cards with an image of an employee in SSRS SQL 2008.
For this I have created a query pulling the following data from Employee table:
EmployeeID
EmployeeName
EmployeeImage
The images are stored directly in the database.
I have created a blank report, formatted it to have 3 columns (re sized it to a fairly small size), inserted a table and deleted all the cells except for one. I have added EmployeeID and EmployeeName into the cell. When run, the report displays exactly what i want: grid of employees with their ID and Name.
In order to display the image, I have added another cell to the original one-cell table and inserted the image control into it. The "Use this field" value of the image is
=First(Fields!EmployeeImage.Value, "Employees")
The inserted image is a jpeg, thus the MIME type is set to image/jpeg.
When i run this, i still get the list of Employees details as before, however the cell, where the image is to be displayed is empty.
Does anyone have any tips on how to achieve what i am looking for?
Thanks
PS: I have googled this without a luck
Just found the answer.
For some reason, i was being offered
=First(Fields!EmployeeImage.Value, "Employees")
under "Use this field".
When i typed in EmployeeImage, it started working.
No idea why this happened though.

Resources