SSRS Report - Horizontally Sort Columns Across Column Groups - reporting-services

I am creating an unusual SSRS report that requires that the user be able to use parameters to select which of the (more than 250) fields appear in the report. So the number of columns in this report can vary greatly.
I've been mostly successful at implementing this, but am stuck at controlling how to change the order of the columns.
Here is (a simplified example) of my original data:
My data as a screen capture
CompanyID | Address | Website_URL | Date_Created | Date Modified |
1 |123 Main Street|www.fake.com | 3/14/2019 | 3/15/2019 |
2 |555 Park Ave |www.notreal.com|3/12/2019 | 3/13/2019 |
The first thing I've done is to unpivot my data within my dataset (i used cross apply to do this). The name of what the column used to be is kept in a column named something like "Col_1", and the value is kept in a column named something like "Val_1". The trick is, I have to do this multiple times, once for each data type that I'm dealing with. Because obviously you can't have dates and nvarchars in the same column. When I unpivot the data above, it looks like this:
CompanyID | Col_1 | Val_1 | Col_2 | Val_2 |
1 |Address |123 Main Street | Date_Created | 3/14/2019 |
1 |Website_URL |www.fake.com |Date Modified | 3/15/2019 |
2 |Address |555 Park Ave |Date_Created |3/12/2019 |
2 |Website_URL |www.notreal.com |Date Modified |3/13/2019 |
The point in doing this is now I can create a matrix is the SSRS report with the CompanyID as a row group. Then I create two adjacent column groups for Col_1, and Col_2, which have as their values Val_1 and Val_2, respectively.
Click here to see SSRS Groupings
Now, when this report runs, each column group (for example, Col_1) expands out to show all the column names I had under that column in my unpivoted data. This could be dozens of columns. This picture shows what my final data looks like. This is similar to what my original data looked like. But with the benefit of the fact that the columns are being displayed dynamically.
My resulting Matrix
So, the only problem I'm having is that the columns are stuck within their groups. Say I want to sort them alphabetically, I can only sort the nvarchars together, and the dates together. I cannot sort the across their groups. Is there a way I can do this?
The resulting Matrix I want, with columns sorted alphabetically
Thanks in advance for any ideas.

Using your original unpivoted data, the design of your report needs to have 4 column groups.
1.Address
2.Date created
3.Date modified
4.Website URL

Related

MS Access: How to compare and filter data in a column

I am a new user and here is my first question,
I have newly started working on MS access and I am having problems to filter maximum of a column data but according to the data in an another column as well.
Let me explain the situation with a test data:
Table consists of Column A, is a short text, and column B is an integer,
Test Data
With a query, i want to filter out only AA-02, BB-04 and CC-06,
I can compare values in a column very easily in excel however i am having problems in Access,
Thanks for your time in advance.
Best Regards,
M.ER
assuming you want the last instance of column B this is a simple sql Totals query. Using the Query Designer:
In the SQL Tab (not shown but bottom right of the query designer)
SELECT Test.ColumnA, Last(Test.ColumnB) AS ColumnB
FROM Test
GROUP BY Test.ColumnA;
Result:
| ColumnA | ColumnB |
| AA | 2 |
| BB | 4 |
| CC | 6 |

Delete partial duplicate rows

I have a Dataverse table that has a few columns. One of those columns is an Order Number column. There should only be one row per order number. If there is more than 1, only the first one should be kept. How can I do this in Power Automate?
What I have tried so far: First, I created an array of all the order numbers. From there, I feel stuck. I started to add an Apply to Each action, loop through the table, count how many of each order number there are, but then I confused myself and didn't think that was the right way to go.
Or...is there a way to keep the "duplicate" rows from getting added to the Dataverse table in the first place? The data is getting loaded into the table via a JSON load. Is there a way to delete the "duplicate" items from the JSON?
Here's an example of the situation:
| OrderNumber | OrderDate | CustomerName |
| 450123| 2-24-22 | Business A |
| 450123| 2-25-22 | Business A |
| 383238| 2-24-22 | Business B |

RDLC how to sum values from child group?

Got second issue:
My table structure in rdlc report looks something like this:
| BookCount |
|Library1 | [Value] |
|City1 | 62 |
|Filial1 | 45 |
|Filial2 | 17 |
|City2 | 40 |
|Filial3 | 40 |
Data grouped by Library names. Then it is grouped by Cities.
By Using =SUM() I received book count in each city, but now I need to sum Cities bookcount (Instead of [Value] there must be 102), and I don't know how to do it (with function help I could, but only if I needed to show values below table). I can't just sum because of expression.
How can I accomplish that?
You need to sum the value outside of the row group.
In the image above, a sum() in the highlighted cell will sum all values for the LibraryRowGroup. A sum() in the cell above will sum all values for the CityRowGroup.
For example, with your data example, the highlighted cell will give you Filial1 value. The cell above will give you City1 value. If you add another row above that, outside the row group, it will give you the value for all data irrespective of Library or City. This will be the same as either summing all cities together or summing all libraries together - the total value in your dataset.
For your expression, you can use this:
=iif(sum(Fields!Active.Value) <= 0, 0, (sum(Fields!Active.Value) - sum(Fields!Taken.Value)) / sum(Fields!Ordered.Value))

Rendering image field in SSRS to fill the page [duplicate]

I am trying to achieve the following layout for my report based on one query.
+----+-------+----+-------+
| ID | Name | ID | Name |
+----+-------+----+-------+
| 1 | Danny | 2 | Dave |
| 3 | Sue | 4 | Jack |
| 5 | Rita | 6 | Sarah |
+----+-------+----+-------+
So I basically want one table, printing my data from left to right to save space on my page, rather than it printing one line and wasting all of the space on the right side of the paper, possibly even go 3 times across the width.
This is my data: http://sqlfiddle.com/#!3/5c911/1
I was maybe thinking a table with 4 columns. Cols 1 and 2 contain the odd row numbers, Cols 3 and 4 contain the even row numbers.
How could I achieve this, I did try something with the MOD function but it didn't seem to work properly, or I misunderstood what was happening.
Related:
How can I display two rows worth of data on one line side-by-side in Report Designer?
Thanks,
To print your data from left to right in a multi-column format, you need to fake it using multiple tables. To implement this hack, create the same number of tables as columns you want side by side that all point to your data set. On the Detail row of the first table, for the Visibility-Hidden property use the following formula:
=IIF((RowNumber(Nothing) Mod 4) = 1, False, True)
where 4 is the number of tables (columns) you have.
Do the same for each table, incrementing what the formula is equal to (so for the second column (RowNumber(Nothing) Mod 4) = 2 and so forth). In the last table (column) the formula equals 0.
This alternately hides the detail row, only displaying the appropriate rows for that column number.
You can achieve that look with query.
SELECT std1.id AS Student_Id,
std1.NAME AS Student_Name,
std2.id AS Student_Id,
std2.NAME AS Student_Name
FROM students std1, students std2
WHERE (std2.id - std1.id = 1
AND std1.id %2 = 1);

SSRS report formatting a table to display data side by side

I am trying to achieve the following layout for my report based on one query.
+----+-------+----+-------+
| ID | Name | ID | Name |
+----+-------+----+-------+
| 1 | Danny | 2 | Dave |
| 3 | Sue | 4 | Jack |
| 5 | Rita | 6 | Sarah |
+----+-------+----+-------+
So I basically want one table, printing my data from left to right to save space on my page, rather than it printing one line and wasting all of the space on the right side of the paper, possibly even go 3 times across the width.
This is my data: http://sqlfiddle.com/#!3/5c911/1
I was maybe thinking a table with 4 columns. Cols 1 and 2 contain the odd row numbers, Cols 3 and 4 contain the even row numbers.
How could I achieve this, I did try something with the MOD function but it didn't seem to work properly, or I misunderstood what was happening.
Related:
How can I display two rows worth of data on one line side-by-side in Report Designer?
Thanks,
To print your data from left to right in a multi-column format, you need to fake it using multiple tables. To implement this hack, create the same number of tables as columns you want side by side that all point to your data set. On the Detail row of the first table, for the Visibility-Hidden property use the following formula:
=IIF((RowNumber(Nothing) Mod 4) = 1, False, True)
where 4 is the number of tables (columns) you have.
Do the same for each table, incrementing what the formula is equal to (so for the second column (RowNumber(Nothing) Mod 4) = 2 and so forth). In the last table (column) the formula equals 0.
This alternately hides the detail row, only displaying the appropriate rows for that column number.
You can achieve that look with query.
SELECT std1.id AS Student_Id,
std1.NAME AS Student_Name,
std2.id AS Student_Id,
std2.NAME AS Student_Name
FROM students std1, students std2
WHERE (std2.id - std1.id = 1
AND std1.id %2 = 1);