SSRS / Visual Studio: Distribute data into columns based on another field - visual-studio-2013

Is it possible to easily distribute data ('subject's in my case) into different columns based on the value of another field ('block' in my case) so I could have a kind of timetabling grid report, i.e.
if my data looks like:
Subject | Block
----------
English | A
French | B
Science | C
----------
x | A
y | B
z | C
How might I produce a table / matrix that looks like:
Block A | Block B | Block C
English | French | Science
x | y | z
(forgive the formatting!)
I can't help thinking this must be straight forward, but I can't seem to find the appropriate technique. Something like a pivot, but listing rather than aggregating values? I thought maybe filtered columns, but that doesn't seem very efficient. Many thanks for any advice!

Using the following as a basis
https://stackoverflow.com/a/9007678/2311633
(I have copied the relevant sections so the complete answer is on this page...)
You can create a horizontally expanding table by:
First create a Tablix by dragging the Matrix Report Item onto the design surface. The Tablix will have a RowGroup and a ColumnGroup by default.
Delete the Row Group by right clicking on it and selecting "Delete Group" In the Delete Group prompt, delete both just the group. (Not related rows and columns; you'll probably want these as left label for your rows.)
At this point right click the Column Group and "Add Group -> Child Group...". Keep adding child groups for each of the rows you require. For each child group select 'Group by' and choose each of the series you wish to display on each individual row.
I am unable to post images at this time, but have been able to recreate what you have requested above. Once I'm able to I'm can post screenshots for further clarification if required.
Update
Alternatively, If you are able to edit the SQL source could you add another field to define a row number for each item. Using ROW_NUMBER() and PARTITION_BY you could add a new column such as
SELECT ROW_NUMBER() OVER(PARTITION BY [Block] ORDER BY [Block]) as rownum
Then you could just create a simple Matrix as shown here https://www.flickr.com/photos/135805284#N08/20883237722/

Related

Howto make one Power BI pie chart widget from two columns data / or merge two pies in one

I have a table with two columns (more in real life)
| firmware_check_result | software_check_result |
| -------------------------|-----------------------|
| firmware checksum error | software outated |
| firmware outated | software slow |
| | software bug |
Results can be any text from a predefined list of reasons.
But results are different in both columns. And a row can have one or no firmware check result and one or no software check result.
I need to build one unique pie chart with all the data from both columns.
Is it possible ? and how to to it ?
I tried to add both columns like this:
Drop a Pie chart on canvas
in Properties:
in Legend: I added both columns
in Values: I added both columns
Result is strange as I have one pie chart
but legend is only the legend of the 1st column, not the second.
It there a way to do this ?
This shows a result with 3 results possibilities but legend has only two and colors are the same for 2 out of 3 results.
Here is one approach. For simplicity I will use only your example columns in my answer:
Create a new query using the same data as before
Keep only the firmware_check_result and software_check_result columns, as well as an index or unique identifier (UID) column of some kind (and any other information you think may be useful later)
I will refer to the UID column as [UID]
Select and unpivot your firmware_check_result and software_check_result columns in the new query
Close and apply the changes
Create a new relationship between your original table and your new unpivoted table based on [UID]
Create a new pie chart
For your values, use Count of [UID]
In the legend, from your new unpivoted query, place Attribute first, then Value underneath
You can switch between the two levels using Drill Up and Expand all down one level in hierarchy or Go to next level in hierarchy

Perform an OR operation on same field from multiple rows SSRS

I am a beginner trying to achieve a simple operation in SSRS using Visual Studio 2019. I have a query which returns a table as follows
ID | Name | Married
1 | Jack | Y
2 | Jack | N
The number of records might vary depending on the number of results. On the report, I want to display only the field 'Married' once. The value of the field will be determined using an OR operation, i.e. if the field 'Married' is 'Y' for any one record, I want to display a 'Y' on the report.
Assuming the Values are either Y or N, you should be able to use something like
=MAX(Fields!Married.Value)
If you report is grouped by, for example, Name then this will give you the MAX value within each group which is probably what you want.
If this does not help, edit your question and show
Your report design
Row Group panel plus details of grouping
A larger sample of data
Expected results from that sample data

show selected columns of table in QlikView

I am creating a Dashboard in QlikView, allowing the user to extract data based on the filters and selected columns. Requirments are below.
“Data Extract” table MUST be empty (even no column names are showed)at first!
Clicking the blue button shows the list of data available.
A table will then show those selected columns.
Does someone know how to do these?
Screenshot:
You need to set a conditional expression on each of your dimension and measures.
A simple example would be to have an ID for each measure, here the measure "NetSales" can be referenced by MeasureID "a".
Measure | MeasureID
NetSales | a
In the conditional expression for NetSales you can have:
=if(IsNull(GetFieldSelections(Measure)),0,SubStringCount(Concat(MeasureID, '|'), 'a'))
This will check the possible MeasureIDs and return 1 if NetSales is selected.
You need to create a "floating" tables with the dimensions & expressions you need to use in the table object:
Here is an example I made : https://ufile.io/j20am (just reload the file If you use personal edition)

Set Order for a Table (Laravel)

I using laravel 5.1 and PostgreSQL.
I have data product, and I want to custom the order by myself.
For example, I have product
{A, B, C, D, E, F}
and I want to show them in a table by what I want
Idx | Item
-----------
1 | A
2 | C
3 | E
4 | B
5 | F
6 | D
To do this I need a page that can setting it right?
My problem is I don't know what page must I develop to create setting order.
Maybe a page that has a table that I can move each row to set the order,
and a database field in item table to save the order setting?
Please someone help me, is there a plugin like that?
You can just create a page that list all items with minimal amount of information. Then you change the order use something like jQuery UI sortable or Dargsort to sort them, and then save the index of the list back to your database as custom index
But keep in mind 100 items is still too many, it would be much better to just provide filter of all attributes to display items in different order.

Access 2013: Check if a value is present in another table

I've just discovered Access, having always been an Excel/VBA man... and now I've hit a roadblock!
I'm building an inventory database for my employer. I have 2 tables, one containing one column of 'stockID's (lets call this table 'tblWarehouse'), and another containing two columns: a column of 'orderID's and a column of 'stockID's (lets call this table 'tblOrders'). (For the sake of this question, lets disregard things like quantity, price etc)
We don't keep all the goods we sell in our own warehouse, some are sourced directly from the manufacturer to the customer, which means that not all tblOrders!stockID will be present in the list tblWarehouse!stockID. I need to find out when this is the case!
I want to create a third column in tblOrders containing a dummy variable = 1 if that particular item is in our warehouse. In other words, I want to create a calculated column = 1 if tblOrders!stockID can be found in tblWarehouse!stockID. Can this be done?
I've found that I can't reference another table directly, so I've been trying my hand at queries, user defined functions and relationships, but to no avail. I've also been having trouble with the Access-lingo and veritable forest of different places to input seemingly the same expressions... so please, if u have an answer for me, be sure to specify where things are located!
Much obliged!!
If you are linking the two tables in a query using an inner join, only order records having at least one stock entry will be included in the result. In order to include those with no stock entry at all, create a left outer join.
SELECT O.OrderID, IIf(IsNull(MAX(W.StockID)), 0, 1) AS StockAvailable
FROM
tblOrder O
LEFT JOIN tblWarehouse W
ON O.StockID = W.StockID
GROUP BY O.OrderID
You can also determin the join type in the query designer by right clicking a relation line and selecting "Join Properties" and then select "Include ALL records from tblOrders ...". You can make a grouping query by clicking the big Sigma-symbol in the symbol list.

Resources