Compute average number of rows per group in Sql Server Reporting Services - reportingservices-2005

I have a table widget in reporting services where I group rows on a given id.
For each group, I display the number of rows per group, using countrows().
How can I display the average number of rows per group at the end of my report ?
What I am missing is : how to count the number of groups?

This is from memory - not sure if this expression is correct:
= Count(Fields!ID.Value) / CountDistinct(Fields!ID.Value)
Assuming that the "ID" you're grouping by is a single field, that sort of expression should get you what you want.

Related

Aggregator transformation gives only one row

In aggregator transformation,I used max function. I am getting single row for each group. But multiple rows have maximum value. How to get the other rows details
In such case you need to calculate the MAX value per group, just as you seem to have done, and then join the result back to the original dataset via Joiner Transformation using value and group key as join conditions. As a result you should get all the rows with max value per group.
This should look more or less as depicted below:
SRC--SQ--AGG-\
\ \
\------JNR--TGT

How to show different groups in same matrix where no parent or child relationship

I am tasked with reproducing a spreadsheet in an SSRS report to save hours of Excel spreadsheet work. I have done all the calculations and got them into a single dataset however I am not able to work out how to display in the same table/matrix.
My spreadsheet looks like this:
Column B is a text column used to describe what the figures in each group are showing. Col C is 'Region' grouping.
I have got this far with my matrix - grouping by region and month. This gives me rows 3 to 8 incl of the spreadsheet.
But I am not able to work out how to add the next group of data (rows 9 to 12 in the spreadsheet) into the matrix. Each group of figures would use an expression to pull by a different field so only using single dataset: I still want it to use the region and month exactly the same as the top group. There is no parent or child relationship between the labels in col B in the spreadsheet.
I have tried adding an adjacent group below but it is still trying to keep it as part of the top group.
Is this at all possible?
do I need to have 6 different matrix, placing them together and just hide the month names in the bottom 5?
This is an extract of the data results. The top group counts the uniques customer id, the second group counts the unique sale id, the 3rd group totals the net sale value, the 4th group totals the profit value, the 5th group calculates the total sales and divides by the number of customers, the 6th group calculates the total sales and divides by the number of sales.
It looks like you will have to have 6 separate tablix and amend the aggregate function and field for each tablix

How to get the sum of values of a column in tmap?

I have 2 columns - Matches(Integer), Accounts_type(String). And i want to create a third column where i want to get proportions of matches played by different account types. I am new to Talend & am facing issue with this for past 2 days & did a lot of research but to no avail. Please help..
You can do it like this:
You need to read your source data twice (I used tFixedFlowInput_1 and tFixedFlowInput_2 with the same data). The idea is to calculate the total of your matches in tAggregateRow_1, it simply does a sum of all Matches without a group by column, then use that as a lookup.
The tMap then joins your source data with the calculated total. Since the total will always be one record, you don't need any join column. You then simply divide Matches by Total as required.
This is supposing you have unique values in Account_type; if you don't, you need to add another tAggregateRow between your source and tMap_1, in order to get sum of Matches for each Account_type (group by Account_type).

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

Oracle - SQL developer query using count

I have this table called, ACTIVITIES:
Name Activity Minutes
JOSE videogames 50
MARISSA videogames 50
TINA CHESS 90
JAKE CHESS 95
For each activity in the table, how do I make a count of how many persons did that activity? I would like to print the activity, the count, and the sum of the minutes in my query.
I tried working by parts & this was my attempt:
SELECT Distinct(Activity), count(Activity) as Total
FROM ACTIVITIES;
However, the query result gave me an error saying: "not a single-group group function"
You can use a group by clause to first group the table by activity then do the count and the sum. For example:
SELECT count(*), sum(NUMOFMINUTES), Activity
FROM activities
GROUP BY activity
Use group by to get the count/sum per activity like so:
select activity, count (activity) as totalcount, sum(minutes) as totalminutes
from activities
group by activity
If you want to get some aggregate value such as a count of a specific value, you first need to group the data into subsets based on the distinct values of that column. That is what that error message was referring to. Note that when you group by activity, the records will consider and display only the distinct values of activity, so you won't need to use the distinct keyword.
TRY this
SELECT DISTINCT(Activity),COUNT(Activity) AS Total FROM ACTIVITIES
GROUP BY Activity
Whenever you use any agreegate function and retrieves another field with it on which you are not performing agreegation then you have to use group by clause with non-agreegate field. so add 'group by Activity' at the end of your query.

Resources