I am filtering a tablix and then grouping both rows (total of 3) and columns (total of 2), with no detail section. One row only has an applicable value for one of the grouped columns. The group by places all of the values in the correct cell. However, if I add an indicator, the row without an applicable value for the column inherits data from another row. Adding the field that the indicator is based on does not make this change. This row (and others that are working correctly) has a null value for the indicator in the first column, IE it shouldn't show up.
Dataset:
+---------+---------------+-----------+---------+
| Family | Description | Value |Indicator|
+---------+---------------+-----------+---------+
| A | Something | 5 | 2 |
| A | Another | 2 | 1 |
| B | Yearly Plans | 63 | null |
| B | Weekly Plans | 4 | 2 |
| B | Yearly Qual | .4 | 1 |
| B | Weekly Qual | .2 | 1 |
| B | Purchased % | .76 | null |
+---------+---------------+-----------+---------+
Filter tablix for Family = B
Row Group: =iif(Field!Description.Value like "Plans","Plans",iif(Field!Description.Value like "Qual","Qualifying",Field!Description.Value))
Column Group: iif(Field!Description.Value like "Yearly*","YTD","Weekly")
Result without indicators:
+---------------+------------+----------+
| Description | Weekly | YTD |
+---------------+------------+----------+
| Qualifying | .2 | .4 |
| Plans | 4 | 63 |
| Purchased % | .76 | |
+---------------+------------+----------+
Result with indicators (Based on indicator field):
+---------------+--------+---+--------+---+
| Description | Weekly | | YTD | |
+---------------+--------+---+--------+---+
| Qualifying | .2 | - | .4 | - |
| Plans | 4 | + | 63 | |
| Purchased % | .76 | | .4 | - |
+---------------+------------+--------+---+
What it SHOULD be:
+---------------+--------+---+--------+---+
| Description | Weekly | | YTD | |
+---------------+--------+---+--------+---+
| Qualifying | .2 | - | .4 | - |
| Plans | 4 | + | 63 | |
| Purchased % | .76 | | | |
+---------------+------------+--------+---+
I have patched the current problem by unioning in a Yearly Purchased % row with null values, but there must be something else going one. Is there something in how indicator's behave that would add values that aren't part of a group?
I realized the same thing, could it be a bug in SSRS indicators, as workaround, you can write an expression inside the cell to check against another cell and investigate if there is data then show the value inside the cell, if not then write nothing.
like: =iif(count(Fields!Field1.Value)>1,"",Fields!Field2.Value)
Related
I have a matrix which has starts out fine
| TType | Sept21 | Oct21 |
| ----- | ------ | ----- |
| DT | 50 | 29 |
| VT | 20 | 30 |
| AT | 10 | 11 |
| Total | 80 | 70 |
The DT/VT/AT is a row group, and the month columns is a column group and the values are SUM(Volume). The total is an ungrouped row that just sums it all. This all works ok.
However, what I want to add is extra rows to the same matrix with a percentage of what each TType is of the total. This would give me something that looks like this
| TType | Sept21 | Oct21 |
| ----- | ------ | ----- |
| DT | 50 | 29 |
| VT | 20 | 30 |
| AT | 10 | 11 |
| Total | 80 | 70 |
| DT | 62.5% | 41.4% |
| VT | 25% | 42.8% |
| AT | 12.5% | 15.7% |
When I try to do this, I have tried using the expression sum(volume) / sum(volume,"groupname") where groupname is my dataset, but this doesn't take account of the column group and split out by months, nor does it take account of the filter which is to ignore a TType I don't need. I have tried making a row group, but then that splits out by the TType, but still ignores the month split.
Does anyone know how I can get this to work as expected?
I would like to ask for a help.I use MySQL 5.7 and I have a Bill of Materials table called BOM.
I have many columns there which I will add later to the query, but for this questionID, Name, ParentID and Quantity is important. I would like to add a calculated column totalQty to my table that will multiply children quantities with parent quantities up to the top level. here is an example of what I want to achive:
+-------+------+------+----------+----------+--+
| ID | Name | Qty | ParentID | TotalQty | |
+-------+------+------+----------+----------+--+
| 1 | A | 1 | 0 | 1 | |
| 1.1 | AA | 2 | 1 | 2 | |
| 1.1.1 | AAA | 1 | 1.1 | 2 | |
| 1.2 | AB | 5 | 1 | 5 | |
| 1.2.1 | ABA | 2 | 1.2 | 10 | |
| 2 | B | 3 | 0 | 3 | |
| 2.1 | BA | 2 | 2 | 6 | |
+-------+------+------+----------+----------+--+
I need this to create a list of materials used per project, so I will multiply totalQTY with unit mass and unit length to get total mass and total length of part. Then I will group and aggregate them by material type.
I have searched the forums, and I have found out that I need to use Common table expressions (CTE) for this. But I have found no explanation in plain english on how to do it for my case.
Thank you very much for any help or hint how to understand the concept.
In a Microsoft Access report, how can I display each record of a field as a column heading with the records of other fields in that columns records beneath it.
My query gives me data in the following format:
| ID | Item | Item Characteristic 1 | Item Characteristic 2 | Other Fields |
|:--:|:------:|:---------------------:|:---------------------:|--------------|
| 22 | Code 1 | Blue | 48 | … |
| 22 | Code 2 | Red | 50 | … |
| 22 | Code 3 | Green | 99 | … |
I'd like to have on my report to look something like this:
| Heading | Data True to All Records1 | More Data True to All Records2 | |
|:---------------------:|:-------------------------:|:------------------------------:|:------------:|
| ------------ | ------------ | ------------ | ------------ |
| Item | Code 1 | Code 2 | Code 3 |
| Item Characteristic 1 | Blue | Red | Green |
| Item Characteristic 2 | 48 | 50 | 99 |
| Other Fields | … | … | … |
| ------------ | ------------ | ------------ | ------------ |
| Footer | Data True to All Records3 | More Data True to All Records4 | |
Currently, I can only get data in the format:
| Heading | | |
|:-------:|:-----:|:--:|
| ---- | | |
| Code 1 | Blue | 48 |
| | | |
| Code 2 | Red | 50 |
| | | |
| Code 3 | Green | 99 |
| --- | | |
| Footer | | |
Where each record is resulting in a new 'row' in the report.
Can anyone help?
Table needs a unique record identifier - an autonumber type field should serve, then consider the following.
Query1:
SELECT RecID, ID, "Item" AS Category, Item AS Data FROM Tablename
UNION SELECT RecID, ID, "ItemChar1", ItemChar1 FROM Tablename
UNION SELECT RecID, ID, "ItemChar2", ItemChar2 FROM Tablename;
Query2:
TRANSFORM First(Query1.Data) AS FirstOfData
SELECT Query1.ID, Query1.Category
FROM Query1
GROUP BY Query1.ID, Query1.Category
PIVOT Query1.RecID;
For posterity, I resolved this by setting out a table of unbound labels.
I gave each of these labels a control name of x-y, where x was the column number and y was the row number.
I then looped through each column and row and changed the caption of the label to the value from my RecordSet.
(Form("FormName").Controls.Item(x & "-" & y)).Caption = .Fields("FieldName")
In my access database, we keep track of two sets of dates. One set is for date of membership dues payments, the other set is date of other contributions (a non-membership donation.) There are multiple dates for each person depending on number of payments made for each type.
Example:
+----+---------------+---------------+
| ID | Dues_Date | Cont_Date |
+----+---------------+---------------+
| 1 | 01/01/15 | 09/12/11 |
| | 01/01/14 | |
| | 01/01/13 | |
| 2 | 07/30/14 | 06/20/13 |
| | | 11/12/11 |
+----+---------------+---------------+
First I needed to know the most recent payment for each of the two fields so I ran a query that tells me the MAX (most recent) date for each field.
Example Query:
+----+---------------+---------------+
| ID | Max Dues_Date | Max Cont_Date |
+----+---------------+---------------+
| 1 | 01/01/15 | 09/12/11 |
| 2 | 07/30/14 | 06/20/13 |
| 3 | 02/11/13 | 09/16/14 |
| 4 | 07/30/12 | 06/20/11 |
| 5 | 12/13/13 | 11/12/14 |
+----+---------------+---------------+
Now I need a third field in the same query to compare the results of the first two fields and show which is the MAX of those two.
I have column 2 and 3 in the query; how can I take that and create column 4 in the same query?
Example Query:
+----+---------------+---------------+-----------------+
| ID | Max Dues_Date | Max Cont_Date | Max Date(DD&CD) |
+----+---------------+---------------+-----------------+
| 1 | 01/01/15 | 09/12/11 | 01/01/15 |
| 2 | 07/30/14 | 06/20/13 | 07/30/14 |
| 3 | 02/11/13 | 09/16/14 | 09/16/14 |
| 4 | 07/30/12 | 06/20/11 | 07/30/12 |
| 5 | 12/13/13 | 11/12/14 | 11/12/14 |
+----+---------------+---------------+-----------------+
Try adapting this to your own scenario:
SELECT tblTest.DueDate, tblTest.ContDate, [DueDate]-[ContDate] AS Test, IIf([Test]<0,[ContDate],[DueDate]) AS MaxRes
FROM tblTest;
"Test" finds which is the later date, ContDate or Due Date. The IIf statement selects the later date.
Does this help?
I'm using VB.Net 2010 and MySQL.
I have two tables in MySQL database 'CAR' and 'CAR_RENT'.
From the VB.Net I want to do the following calculations:
I want to calculate the total_fee Column in CAR_RENT. Which can be multiplying the rental_fee column from 'CAR' table with the date difference of Issue_date and return_date from 'CAR_RENT' table.
I want to calculate the penalty_fee column of 'CAR_RENT' table by finding the exceeded date from the return_date. That should be rental_fee*number_of_exceeded_date for specified client.
That should be automatically calculated when the program is run.
I know that the code I tried is completely not formal way so no need to post it here. Please I need your help??
TABLE:CAR
+-----------+----------+---------------+--------+----------------+
| Car_id | Plate_no | Model | color | Rental_fee_day |
| 100 | 25534 | Tesla Model S | Black | $3500 |
| 101 | 25535 | Audi A6 | Black | $2100 |
| 103 | 35625 | BMW 3 Series | silver | $2000 |
+-----------+----------+---------------+--------+----------------+
TABLE:CAR_RENT
+-----------+--------+------------+-------------+-----------+-------------+
| Client_id | Car_id | Issue_date | Return_date | Total_fee | Penalty_fee |
+-----------+--------+------------+-------------+-----------+-------------+
| 1 | 103 | 2014-02-01 | 2014-02-10 | | |
| 1 | 100 | 2014-02-01 | 2014-02-15 | | |
| 3 | 101 | 2014-02-18 | 2014-02-30 | | |
+-----------+--------+------------+-------------+-----------+-------------+
you should check here this is the DateDiff function for mysql.
you can use this and a join to get the info you need....