How to create non filtered summary in a filtered report in crystal reports - filter

Pretty new to CR
I have a grouped survey report filtered by a parameter so (of course) all the summary's in the report are being filtered by the parameter.
I need a "average" summary on a group (question) that is not filtered by the parameter.
Not sure on how to go about this.
Thanks

There are many options to tackle this problem, but the one that will require the fewest changes to your report will be if you use a SQL Expression (basically a subquery) to get that unfiltered average.
Let's say that you're grouping your report by {table.group} and looking for the average of {table.number}. You could create an expression like:
case when "table"."group" is null then null
else (select average(number)
from table
where group="table"."group")
end
Note that the double-quoted fields refer back to the main query, so you're effectively correlating the average per group back to each row from the main report which can then be used in the Group Footer or Group Header.

Related

OBIEE Merge two queries (join)

I need help.
I am new to obiee (recently moved from business objects and re-creating all reports in obiee).
Here is an example I need help with. I have created an analysis where I am listing all orders with their target delivery dates and number of products in each order.
Order Id......Target Delivery Date...No of products
Abc....1/1/2016.....5
I want to add to a column next to No of products called "No of prods delivered on time". I want to compare delivery date of each product within a order with the target delivery date and
Give count of products delivered within the target date.. So the output should be
Abc....1/1/2016....5.....3
Where 3 is number of products delivered on time.
I could do it in BO by running two queries and merging them however in obiee I am not able to add second query to my analysis. I did try at product level using case when target date >=delivery date then 1 else 0 and wrapped this with sum function to aggregate but it didn't work ..
Appreciate your help in this. Searching for this topics give me results for running queries from multiple subject area :(
You also have unions in OBIEE, you union the results of 2 queries which return the same structure, so you have query A with Order ID, Target Date, No Products and a Dummy column with a 0 and default agregation Sum, and a second query with Order ID, Target Date, Dummy column summing 0 and the number of products delivered.
You do all this in the criteria tab of the analysis. It's important the order in which you put your columns, because that's what OBIEE is using to do the union.
Regards

SSRS Tablix Cell Calculation based on RowGroup Value

I have looked through several of the posts on SSRS tablix expressions and I can't find the answer to my particular issue.
I have a dashboard I am creating that contains summary data for various managers. They are entering monthly summary data into a single table structured like this:
Create TABLE OperationMetrics
AS
Date date
Plant char(10)
Sales float
ReturnedProduct float
The data could use some grouping so I created a table for referencing which report group these metrics go into looks like this:
Create Table OperationsReport
as
ReportType varchar(50)
MetricType varchar(50)
In this table, 'Sales' and 'ReturnedProduct' are the Metric column, while 'ExecSummary' or 'Quality' are ReportType entries. To do the join, I decided to UNPIVOT the OperationMetrics table...
Select Date, Plant, Metric, MetricType
From (Select Date, Plant, Sales, ReturnedProduct From OperationMetrics)
UNPVIOT (Metric for MetricType in (Sales, ReturnedProduct) UnPvt
and join it to the OperationsReport table so I have grouped metrics.
Select Date, Plant, Metric, Rpt.MetricReport, MetricType
FROM OpMetrics_Unpivoted OpEx
INNER JOIN OperationsReport Rpt on OpEx.MetricType = Rpt.MetricType
(I understand that elements of this is not ideal but sometimes we are not in control of our destiny.)
This does not include the whole of the tables but you get the gist. So, they have a form they fill in the OperationMetrics table. I chose SSRS to display the output.
I created a tablix with the following configuration (I can't post images due to my rep...)
Date is the only column group, grouped on 'MMM-yy'
Parent Row Group is the ReportType
Child Row Group is the MetricType
Now, my problem is that some of the metrics are calculations of other metrics. For instance, 'Returned Product (% of Sales)' is not entered by the manager because it is assumed we can simply calculate that. It would be ReturnedProduct divided by Sales.
I attempted to calculate this by using a lookup function, as below:
Switch(Fields!FriendlyName.Value="Sales",SUM(Fields!Metric.Value),
Fields!FriendlyName.Value="ReturnedProduct",SUM(Fields!Metric.Value),
Fields!FriendlyName.Value="ReturnedProductPercent",Lookup("ReturnedProduct",
Fields!FriendlyName.Value,Fields!Metric.Value,"MetricDataSet")/
Lookup("Sales",Fields!FriendlyName.Value,Fields!Metric.Value,
"MetricDataSet"))
This works great! For the first month... but since Lookup looks for the first match, it just posts the same value for the rest of the months after.
I attempted to use this but it got me back to where I was at the beginning since the dataset does not have the value.
Any help with this would be well received. I would like to keep the rowgroup hierarchy.
It sounds like the LookUp is working for you but you just need to include the date to find the right month. LookUp will return the first match which is why it's only working on the first month.
What you can try is concatenating the Metric Name and Date fields in the LookUp.
Lookup("Sales" & CSTR(Fields!DATE.Value), Fields!FriendlyName.Value & CSTR(Fields!DATE.Value), Fields!Metric.Value, "MetricDataSet")
Let me know if I misunderstood the issue.

How do I specify columns to include in a matrix

I have a matrix that has a group filtered at the matrix level. I can't filter the SQL because it is very large and is used all over my report.
I need to be able to specify the columns to display after the filter is applied.
The end filter would look something like this
if ColumnA[value] IN Test1,Test2,Test3 OR ColumnB[name]
As you can see I want a value string filter and make sure ColumnB get displayed at all times.
Or being able to specify the columns to show in the matrix would work also.
You can filter at the dataset level: see here for more detail.
To filter a tablix, go into Tablix Properties and open up the Filters tab. You can write a Boolean expression (must evaluate to TRUE for the record to come into the Tablix) to do the filtering there.
I ended up using a tablix and creating columns for each column I wanted to display and rows for each row item. I then used a Count(IIF()) statement to match the specific item I needed to calculate for that cell. I wanted to use the matrix so it would not be so long winded but in the end I got the job done. I have since used this method on many occasions.

Can I receive data from .rdlc Report Parameters?

I have a VS 2010 Report, and I would like to pass values that are calculated inside of one .rdlc report to another. Can I somehow use the Parameters to send data back out of the report, or have some "return" value from the .RDLC?
I don't think you can have return values with report services.
Instead, assuming that the two report have different dataset, the only solution I come out so far is to include two dataset in your second report and recalculate your field.
Doing that, you can use your normal expression to calculate the values that you need from the first report specifying the first dataset.
Here really simple example:
Report 1
The report is using only the DataSet1
=Fields!AField.Value
Report 2
The report is using two dataset: DataSet1 and DataSet2
=(Fileds!AField.Value, "DataSet1") + (Fields!AnotherField.Value, "DataSet2")
Ofc the expressions could be more complex, but the most important thing is to specify the DataSet where the report have to take the filed.

iReports Grouping Bug - Multiple Occurrences?

I'm am getting irritated with iReports. Problem is that I have a data set returning data for multiple customers and I want to use the "Group Expression" against the customer ID and have the report lay out the Detail Tabs per customer.
I'm finding that, seeming randomly, where there is more that one data row for a customer iReports will generate two or more groupings (Sometimes it does what I expect and group all the customer data together), the field IDing the customer is the same and doesn't change.
Has anyone seen this before? To be honest I can't believe it is actually a bug, but something I've missed. Just much searching as yet to find a suitable result.
I think this is a data sorting problem.
The quote from iReport Ultimate Guide:
JasperReports groups records by evaluating the group expression. Every
time the expression's value changes, a new group instance is created.
The engine does not perform any record sorting (if not explicitly
requested), so when we define groups we should always take care of the
records sorting. That is, if we want to group a set of addresses by
country, the records we select for the report should already by
ordered by country. It is simple to sort data when using an SQL query
by using the ORDER BY clause. When this is not possible (that is, when
obtaining the records from an XML document), we can request that
JasperReports sort the data for us. This can be done using the sort
options available in the query window
You can sort data in these ways:
in case using of Database jdbc connection datasource type you can add ORDER BY customerId clause to the report's query, where customerId - column name of field with customer id
in case using of File csv connection or something like this you can organize data sorting by adding sortField property for field to the report's template (jrxml file):
<jasperReport ...>
...
<field name="customerId" class="java.lang.String"/>
<sortField name="customerId"/>
SQL Statement has ORDER BY?
iReport group is grouped by customer_id?

Resources