Business Objects - Summarising Data in a Separate Report - business-objects

I'm trying to make a neat 'front end' report tab (Summary) that just contains the summary information from another report tab (Report1) but I can't seem to get my summary working correctly.
I have some data (Report1) like so, where I have created a variable to flag if 'Value' is above 500:
ID Value Above
1234 400 0
2345 600 1
3567 200 0
5687 1000 1
So I want to sum up over 'Above' in a separate report tab (Summary). I can't find anything that works yet so any function ideas etc would be much appreciated.

Add a new query in the data provider which Counts the No of IDs with a value of 500 and more and use that Value to display in the main sheet.
Regards,
vijay

I found a solution to this:
=sum([Above]ForEach([ID]))

Related

SSRS: Can I exclude Report rows based on a Report calculation?

I inherited a report where the Grouping and Aggregation is done in the Report. The Dataset is a SQL Server 2008 Query.
This raw Data:
ID Budget Amount Spent Amount
A 1,500 20
A 1,500 20
A 1,500 60
B 2,000 50
B 2,000 75
B 2,000 75
Shows like this on the report:
ID Budget Amount Spent Amount
A 1,500 100
B 2,000 200
I added a calculated field to the Report to get this:
ID Budget Amount Spent Amount Balance
A 1,500 100 1,400
B 2,000 200 1,800
Can I do something in the report to exclude rows that have a balance less than 1,500?
If not, what are my other options?
****************************
. . . the next day . . .
Having tried suggestions to add a Filter Exp. to the Tablix and a Row Visibility Exp. to the row - unsuccessfully - here is what I found:
My actual report has two Row Groups on the row for which I want to limit the rows that show.
I tried the same suggestions made in this thread on another report [with no Row Groups] ... and the Tablix Filter and the Row Visibility both worked fine.
I have to assume that the fact that my 'problem' report has two levels of Grouping is the cause of the Expressions not working.
BUT . . . is there a way to overcome this?
****************************
I just realized [while researching this same issue elsewhere] that the report I am working with does not have a 'Details' row.
What I was thinking of as a Details row is not. There is no Details Row in this report. I have been trying all your suggestions on a row that is not a Details row.
You can reference a textbox field in your report, per the comments in the thread:
=IIF(ReportItems!textbox1.Value <= 1500, True, False)
Throw this expression in the row details visibility section. Or you can even use the filters section to filter this data out. Tons of ways to do this.
Thanks for all your suggestions. They helped me arrive at a solution.
As I said in my [edited] post, my report has no Details Row.
I was adding the expression to the Visibility Property of the Row on the report Tablix which was not a Detail row.
After reading the topic here:
https://dba.stackexchange.com/questions/53727/how-to-hide-rows-in-ssrs-report
I did this:
-> Right-clicked the last/lowest of the Row Groups in the Groups pane,
-> Group Properties,
-> Visibility,
-> Show or hide based on an expression &
-> Entered this expression [does not relate exactly to my example in the post]:
=IIF((Avg(Fields!AMOUNT_1.Value) - Sum(Fields!AMOUNT_2.Value)) >= 0, True, False)
It is now working exactly as needed.
Thanks for all your input!

Sum Values from Dataset based on condition: Report Builder

I have a report where users can select items from various location. And I have 3 datasets performing calculations where the third dataset takes the sum where item number is 4942200 and then calculates the values (as shown below):
=SUM(IIf(Fields!masterno.Value= "4942200",Fields!Owned.Value,0))+SUM(IIf(Fields!masterno.Value= "4942200",Fields!Subbed.Value,0))
This is returning error for some reason. The subbed column is toggled based on parameter (visibility). But before I add the toggle functionality, I want to make sure this is working. Can anyone help. I have also tried:
=SUM(IIf(Fields!masterno.Value= "4942200",Fields!Owned.Value+Fields!Subbed.Value,0))
This seems to fail as well. Help would be greatly appreciated.
I would wrap a CDec around Owned, 0 and Subbed, e.g.
=SUM(IIf(Fields!masterno.Value= "4942200",CDec ( Fields!Owned.Value) ,CDec (0 ) ))+SUM(IIf(Fields!masterno.Value= "4942200",CDec (Fields!Subbed.Value ) ,CDec ( 0 )))
If Owned and Subbed are already Decimals, those CDec's may be redundant. On the other hand SSRS doesnt expose this info and they can change at the whim of the data source.

Show difference in records - MS Access 2007

I have a subform with the following layout:
ID---Count---Difference---Weight---Difference
Populated with data looks like this:
ID---Count---Difference---Weight---Difference
1----5--------------------8.3----------------
2----9--------------------12.3---------------
3----16-------------------17.8---------------
How can I tell the difference between a record value and the one before it? Using the previous example, I'd like the Difference controls to look like so:
ID---Count---Difference---Weight---Difference
1----5-------0------------8.3------0---------
2----9-------4------------12.4-----4.1-------
7----16------7------------17.8-----5.4-------
As you can see, since record ID 1 is the first record, the difference is 0; however, ID 2 shows a Count Difference of 4 (9-5) and a Weight Difference of 4.1 (12.4 - 8.3); and ID 7
shows a Count Difference of 7 (16-9) and a Weight Difference of 5.4 (17.8 - 12.4).
Also note that the ID #'s do not necessarily increment one-by-one (there can be gaps).
How can I achieve the desired results? Expressions? VBA?
Any help with this is greatly appreciated!
Found my answer. Method 2 in this article described exactly what I need.

grab mysql result based on field values

I am taking over designing a CMS from another programmer. As the site is filling up, we're finding loops in mysql queries causing long hangs. I have found a temp solution for this one, but am wondering if there is a quicker way of doing it?
take the table (tracks resources):
id resource click
1 res_1 192
2 res_2 12
3 res_3 300
what we need to get is a popularity of the resource - res_click/total_click
what he had was a while loop:
while ($item = mysql_fetch_array ($result)) $total_clicks = $total_clicks + $item[0];
As there could be 100 or more resources to a page, this was running for each resource, and it is causing major hangs.
My solution is to get a sum:
SELECT SUM(click) FROM uri
SELECT click FROM resource WHERE id=$x
then divide them both.
But this two calls are still running for around a 100 items per page. Is there a way I can have a field in mysql that is the result of a formula based on another another, like in excell? So I could add a field "percentage", tell mysql that it is the sum of click divided by the current click value, then every time click is updated the 'percentage' field is automatically updated?
any help would be appreciated,
cheers ;)
you can create a view on your table that present the sum you want

Access Expression problem: it's too complex, so how do I turn it in to a function?

Access 2007 is telling me that my new expression is to complex. It used to work when we had 10 service levels, but now we have 19! Great! I've asked this question in SuperUser and someone suggested I try it over here. Suggestions are I turn it in to a function - but I'm not sure where to begin and what the function would look like.
My expression is checking the COST of our services in the [PriceCharged] field and then assigning the appropriate HOURS [Servicelevel] when I perform a calculation to work out how much REVENUE each colleague has made when working for a client. The [EstimatedTime] field stores the actual hours each colleague has worked.
[EstimatedTime]/[ServiceLevel]*[PriceCharged]
Below is the breakdown of my COST to HOURS expression. I've put them on different lines to make it easier to read - please do not be put off by the length of this post, it's all the same info in the end.
Many thanks,Mike
ServiceLevel: IIf([pricecharged]=100(COST),6(HOURS),
IIf([pricecharged]=200 Or [pricecharged]=210,12.5,
IIf([pricecharged]=300,19,
IIf([pricecharged]=400 Or [pricecharged]=410,25,
IIf([pricecharged]=500,31,
IIf([pricecharged]=600,37.5,
IIf([pricecharged]=700,43,
IIf([pricecharged]=800 Or [pricecharged]=810,50,
IIf([pricecharged]=900,56,
IIf([pricecharged]=1000,62.5,
IIf([pricecharged]=1100,69,
IIf([pricecharged]=1200 Or [pricecharged]=1210,75,
IIf([pricecharged]=1300 Or [pricecharged]=1310,100,
IIf([pricecharged]=1400,125,
IIf([pricecharged]=1500,150,
IIf([pricecharged]=1600,175,
IIf([pricecharged]=1700,200,
IIf([pricecharged]=1800,225,
IIf([pricecharged]=1900,250,0)))))))))))))))))))
UPDATE (16/04/10 14:46 GMT)
I've built a new table as recommended below. Now it's matter of removing my expression and making my original SELECT query use the new table. However, I'm not at all clear on how this is done.
Using the DLookUP example I imagine I keep the original query where I have my PRICECHARGED field, include a new DLookUp field that uses the example below to refer to the PRICECHARGED and populate the rows with the appropriate SERVICELEVEL (hours).
I become confused at this point because in my original SELECT query all the calculation happened in that query (expressions, after expression), which meant that the final result of my query was a list of colleagues with HOURS, and REVENUE (Cost) against their name. I have a feeling that I'm in need of another query in the middle to manage the DlookUp process.
`Any directions or road map very much appreciated.
Final update. Added another table as mentioned above, created the appropriate links from the new table to the field in the 'fixed'table. Voila. It worked a charm, and without me doing anything that caused it to crash or give me an error warning. It was easier than I thought. I don't understand why I didn't manage it this way before.
Thanks again, Mike
You're making life really, really, really hard for yourself.
Create a table PriceToHours with columns PriceCharged and Hours. Put the appropriate rows into it so it matches the tabular data in your expression. Now JOIN that table to your main data table to get the Hours from the PriceCharged. When this information changes in the future, simply update the data in the table. This is much more transparent (no data hidden in a query expression) and requires no additional programmer time when the values change in the future.
I would suggest changing the way this works and keeping the service level to price charged logic in a separate table. This would allow you to change it quickly if the business need changed.
The table would just be as simple as two columns and “ServiceLevel” and “PriceCharged”. Then in your query link that to your table.
For a quick check however what would happen in the price charged was say 1105 i.e. not in the list? The function would possibly return a null which would then cause the expression to fail maybe that is causing it?
EDIT::
After a bit of searching around it looks like the maximum number of nested IIF statements in access is 10 hence why it worked fine before but now does not. Looks like your only option is to redesign it to how it should have been in the first place!
Put all the data into a table and do a dLookup! Here is a table called CostHours
Cost Hours
---- ------
100 6
200 12.5
210 12.5
300 19
400 25
410 25
500 31
600 37.5
700 43
800 50
810 50
900 56
1000 62.5
1100 69
1200 75
1210 75
1300 100
1310 100
1400 125
1500 150
1600 175
1700 200
1800 225
1900 250
And to get the hours from the cost, here is a dLookup
dLookup ("Hours", "CostHours", "Cost=" & 100)
This will return the hours where the Cost is 100. Use that value in your calculations.
The beauty of MS Access is that dLookup can sit in the same place you do your calculations - in code, in a report, in a query.
Instead of a DLookup, you can do this in a SQL Statement as well
"SELECT Hours From CostHours Where Cost" = & CostVariable