Reports sum don't sum as they should

Hi,
I created a report where it displays, in order: COST CENTER, PROJECT, EMPLOYEE, JAN, FEB... DEC
Then I check on sum for JAN, FEB.... DEC under columns attributes.
Then I have a break for the first and second columns (COST CENTER, PROJECT), so it will give me a sum for project total, and a sum for cost center total.
The thing is that there is a case that the project is the same, but in different cost center, what the report is doing is that since the project is the same, even though the cost center is different, it's returning a sum for project total combining 2 different cost centers. This should not happen since cost center is highest in the hierarchy so even 2 different cost centers with the same projects, it should return a sum of the projects separtely, since although the same project, they belong to 2 different cost centers.
How can I fix this?
Thanks,

I have no idea if this is "good" SQL or not, I played with it until it worked. :-)
Going through the SQL a line at a time:
select decode(grouping_id(cost_center)+grouping_id(project)+grouping_id(amount),3, 'Report Total:',2,'Cost Center '||cost_center||' Subtotal:',1,'Project '||project||' Subtotal:',0,null) tag,grouping_id(item) is set to 1 when that item level is being totaled, 0 otherwise. So this is basically a case statement. Column 1 is the 'Tag' field, which is just a label and not in the database.
If the sum of the grouping_id values is 3, then select the text 'Report Total:' for column 1
Else if the sum is 2, select 'Cost Center ' concatenated with the value of the current cost center, concatenated with 'Subtotal:' in for column 1
Else if the sum is 1, you're subtotalling the project, so select 'Project' concatenated with the project value and 'Subtotal:' for the 'Tag' column.
Otherwise, display null.
This brings up a feature I'd like to see in ApEx: It would be nice to be able to display not only the column headers in the break row, but also the value/name of the item currently being totaled. Another nice feature would be if I could get around having to use this 'Tag' field and, instead, have column 1 span several TD cells so that I could get the label over next to the subtotal values instead of in column 1.
On to line/column 2. Similar to before, this is a case statement, determining what goes in the cost_center field:
decode(grouping_id(cost_center)+grouping_id(project)+grouping_id(amount),0,cost_center,null) cost_center, If the sum of all three grouping ids is 0 (not rolling up or subtotalling), show cost_center, otherwise show null.
The next line, for project, works the same way.
decode(grouping_id(cost_center)+grouping_id(project)+grouping_id(amount),0,project,null) project, If the sum of all three grouping ids is 0 (not rolling up or subtotalling), show project, otherwise, show null.
The next field, Amount, is a little tricky:
decode(sum(amount),amount,amount,sum(amount)) amount, Again, take it as a case statement (or if-then-elseif)...
if the sum(amount) is the same as amount (displaying regular row), show the amount, otherwise, show the sum(amount).
Why do this? Because I don't want two columns for amount and sum(amount). I want the sum to display in the Amount field on a report row. I suppose I could have summed up the grouping_id values as before, eh?
In the report attributes, I suppress the display of the last field, sum(amount).
sum(amount) The final bit defines the grouping sets:
from breakreport group by grouping sets((cost_center, project, amount),(cost_center, project), (cost_center),());This says: Aggregate on amount, then project, then cost center, then give an overall total.
Google for "grouping_id oracle" and you'll find a bunch of very nice links to Ask Tom and other places that discuss grouping.

Similar Messages

  • Characters don't appear as they should in SMSes

    Hi,
    This is specific to just these characters that I use quite frequently in my SMSes, the square brackets - [ ]
    When I type them in, they appear as they should on +my phone+, but peculiarly, they appear as "<?" and "?>" instead on the receipient's phone.
    Here are my settings on the iPhone:
    - iPhone 3G
    - Language: English
    - Keyboard: English
    Has anyone faced the same problems? Do let me know. Better yet, has anyone faced and then fixed the problem?

    Oh, I missed out adding that when I receive square brackets on my phone, they appear as they should - and it also is part of the recipient's phone set, because it worked fine before, on my other phones, and the square brackets appear as they should when it is in SMSes from them.

  • I'm doing a vector, however the pen and Elipse tools don't work as they should.

    As I said, I'm working on a vector, but now whenever I use the pen or elipse tool, the shape doesn't fill in, even at 100% opacity. Changing to other tools I get a message that always ends with "Because the pixels in a group cannot be edited without merging the group."
    I'm left scratching my head, I only started using photoshop a few days ago and would prefer not to merge the groups together.
    I'm using CS2 if that helps at all.
    Any help would be appreciated.

    Albatross01 wrote:
    I feel like a fool for not looking closer
    Making fools of us is just a Photoshop side effect I don't believe Adobe programmers do it purposely they just can't seem to get thing right so the keep changing and breaking Photoshop. Photoshop culture take some time to become accustom too.

  • Shared Reminders don't work like they should

    I have set up shared reminders in iOS and iCloud, but they don't seem to work at all like I would have hoped.
    Basically, I'm looking for a way for my wife to push reminders to my shared list so that I (not her) am reminded with an alert, and vice versa. 
    Currently, the way it works is, she can add a reminder to my shared list, but it will only remind her and *not* me.
    So it seems like while it was a nice thought, it was more of an afterthought, and wasn't really thought through well -- very un-Apple like.
    Or am I missing something?

    Update: Because I'm not allowed to edit my own question (don't know why...) I have to make a reply...
    to point 1) I made a strange discovery - the problem only shows up, when I use the Spotlight-Button in the menu bar... if I'm opening a search window with "cmd +f" it works perfectly... no Safari-History in there...!

  • I have messed up the settings on my Mighty Mouse and don't know where they should be.  I cannot open a document by double-clicking anymore.  I don't know what setting adjusts that.

    I need help with my Mighty Mouse settings.  Don't understand the settings.  I can no longer open a document by double-clicking.  I think I changed my setting someway when I was trying to correct or find my up and down scrolling.   Please help. 

    I think you need to un-pair your mouse.   Leave it a few minutes than re-pair it as if you were starting from scratch and using the following details.   Item 1 will probably meet your needs.
    Troubleshooting wireless mouse and keyboard issues

  • Flash file zooms but buttons don't stay where they should

    I've attached the example files I'm working with.  I have a zooming component that zooms in my flash file by loading it with an .xml file, but the buttons don't stay over the buttons once it gets loaded into the component.  The buttons move off into space.
    Do you see what the issue is?

    I think what is happening is that the whole file is scaling which is somehow messing up the positioning of the buttons.
    Here's what I've done so far:
    - create a movie clip of .swf file toolip and center it.
    - the zoom_test.swf loads in the 2008_19.swf file to be zoomed and panned via the data.xml file
    Since I created a movieclip of the .swf file tooltip, when you open up 2008_19.swf, the tooltip does not rollover the button anymore,
    it is a little further away from the button.
    I'm not sure what you mean by scaling the parent, because with this functionality, the whole file, 2008_19 is being scaled.

  • Make FIREFOX stop taking over my documents! I'm a writer, and they don't open as they should after Firefox takes them over!

    When I check files, some of my documents--those which have been emailed--are changed from Word to Firefox. The altered documents (some entire novels waiting for acceptance from my publisher!!!!) are no longer Word documents. BESIDES the aggravation of having to handle these documents differently, have any changes been made to the structure or the contained words?

    Hello Wyodor,
    thanks for your reply on my question.
    You are wright the index file is 308 KB.
    And offcourse that I delete my files and documents is not an Iweb problem, but because my English is not that good, that I thougt I try to tell the whole story, and hope people can read trough the lines.
    Why I didn't use Iweb to upload to the server is because the server company recommanded to use file zilla. And I am a nobody with this kind of things, so I did exactly what they tell me to do.
    No, i did not make a backup of Iweb and the domain file, but reading other messages on this forum showed me that I can maybe try to make empty the cashfile (?)
    and otherwise I have bad luck and have to make my website again. Offcourse I have a lot of examples from all the pages (copied from the local map to my USB stick) and my website is aprox. 15 Mb, (not so big) so it will cost me a few nigths.
    But I'm still hoping on a miracle :-)
    greetings Lasource

  • Built-In Domain Level Groups dont have permissions on domain they should on 2012

    Hello,
    First this is a brand new domain environment with everything running server 2012 datacenter edition.
    Second I've never seen anything like the following occur in a domain environment. What I had is what appears to be a bad 2012 AD structure however so far all AD tests come back good. The problem is the built-in domain level groups do NOT offer any level
    of access that they should. For example if I add a user in the administrators group, they don't have any permissions that group is supposed to have. THe same with every other builtin, backup operators, server operators, account operators and on and on. The
    only way a user gets that level of access is if I add them into the domain admins group. As you can imagine this is crazy and not a solution for my help desk crew. (having them all be domain admins that is) So while I could very well use delegation, I need
    to find out why my builtin groups don't function as they should.  Anyone have any ideas on what to check or where to look?  I'm at the point of opening a case with Microsoft on this.
    Thanks in advance

    Because those builtin groups AREN'T domain level groups in the way you're thinking. The Administrators group on the server gives users administrator permissions on the server, but that doesn't mean permissions on the entire domain.
    If you look in the user list in ADUC you'll see that while Domain Admins are a Global security group, Administrators is only a local group, eg local to the server (or more accurately since they no longer have local details, to domain controllers), so doesn't
    grant permissions to anything outside of the domain controller. On all non DC's the machines have their own local administrators group which is independent of the domain one, and can have different memberships.
    So if you only need a user to have permissions to the DC then administrators is fine, but if you need them to have access to the entire network, eg other servers and workstations, then they need to be members of domain admins. If you only want them
    to have limited permissions then you need to grant those permissions either via a global/universal group, or by adding them to the relevant local group on each machine they need access to.

  • How to Suppress Report Total When Using Sum on Columns & Break Formatting

    I need to know how to NOT show the report total line when using the sum functionality with a break in a report.
    I am summing two columns, a debit amount and credit amount. I am breaking on the first column which is the level of a hierarchical query. I want to see something like this:
    Parent Record xxxxxxxxxxxxxx
    Parent Sum $$ $$
    Child Record xxxxxxxxxxxxxx
    Child Record xxxxxxxxxxxxxx
    Child Sum $$ $$
    However, when I run the report, I also get a report total line under the child sum which is really meaningless for this report.
    I have also tried creating this report as an interactive report. When applying the sum on the two columns, I do get the sum totals on the break only - no report total - however, it is reversing the order of the hierarchical query results putting the child records first and the parent records second.
    Thanks in advance for your help.

    Hi, and welcome!
    I don't think that there's an easy way to "switch off" the Total line on a report. The nearest I could suggest would be to either hide the entire row or colour the text so that it's the same as the background - either way, the total is calculated but the user won't see it.
    If you put something like the following into your report region's Region Footer:
    &lt;script type="text/javascript"&gt;
    var outertable = document.getElementById("#REGION_ID#");
    var innertable = outertable.getElementsByTagName("TABLE")[1];
    var rs = innertable.rows;
    var lastrow = rs[rs.length-1];
    if (lastrow.cells[0].innerHTML == '&lt;b&gt;TOTAL&lt;/b&gt;')
    rs[rs.length - 1].style.display = "none";
    &lt;/script&gt;Then, on your report's Report Attributes page, scroll down to the Break Formatting section and put TOTAL into the "Display this text when printing report sums" setting. Also, in the "Layout and Pagination" section, set "Enable Partial Page Refresh" to No.
    The above code is based on the report and region templates that I'm using here: [http://apex.oracle.com/pls/otn/f?p=267:147] (Theme 18, "Report Region" region template and "Standard" report template). Your report may use different templates, so the first two lines on the code may have to change. #REGION_ID# would be replaced with the region's ID value (which would be "R" followed by a long number). As long as you can identify the HTML tag that uses this ID value, you can then get to the actual table that contains the data as it would be a TABLE within that tag - the [1] above is the second table within the region. In some instances, you may have to use "region_#REGION_ID#" as the starting point.
    Andy

  • Can apple help me find my iPod touch 5g??? I have already reported it to the police and they haven't called back, i also have the find my iPhone app in it but I don't have the location thingy turned on so what else can I do to locate it pleazz help

    Can apple help me find my iPod touch 5g??? I have already reported it to the police and they haven't called back, i also have the find my iPhone app in it but I don't have the location thingy turned on so what else can I do to locate it pleazz help this iPod is relly valuable to me I had gotten it for Christmas and now I proved that I can't be trusted with it HELP :c

    Police don't "track down" lost items, per se. They'll keep your information on file in the event that someone finds your iPod and turns it in. Otherwise, there's nothing the police can or will do in regards to finding lost property.
    Sorry, but your iPod is most likely gone for good.
    Regards.

  • I have a problem with my Apple ID I made an Apple ID but they want me to add a credit card which I don't have so what should I do

    I have a problem with my Apple ID I made an Apple ID but they want me to add a credit card which I don't have so what should I do

    i have the same problem, i cant install and update my apps, always pop out i have to sign in to my account which its already signed in, and verifying billing account but says i typed in wrong security code which is right

  • Sum of a sum when using Top N in the Group Sort Expert

    Hi All,
    I have a small problem I can't quite seem to work out.
    I have a report where each line is for a particular Product, and is a summation of the Sales for that Product over several Locations. When you click on the line, it shows the breakdown of Sales over each Location.
    I use the Group Sort Expert to display the Top N results, where the 'N" is set in a formula to a parameter passed in to the report, so the user can select the top 5,10,50 etc. Products across all Locations.
    At the bottom of the report, I want to have a sum of a column of Sales $. I need that sum to only be a sum of the Top N records selected.
    Since each line is a summation of the all the products for the Locations, what I need is a sum of that sum for the Top N, but Crystal will not let you add the sum of a sum, so I'm not sure how to accomplish this.
    If I just do a sum of the underlying values I get a total for all the Products, regardless of the Top N.
    Hope that makes some sense !
    Many Thanks
    Paul

    Hi Sastry,
    I tried your suggestion, thanks, but I don't think it's the answer. For a start Crystal will not let me do that, it pops up a message box when I try to run the report "A running total cannot refer to a print time formula. Details: Record Number". I also added the record number field next to the lines in the report to see what the result would be, and I don't think it would work anyway.
    Here is an example using Units sold:
    Product Name--LocationUnits Sold--Record Number
    Product A -<All Stores>----8
    Store A--1--
    1
    Store B--3--
    2
    Store C--4--
    3
    Product B--<All Stores>--3      
    Store A--2--
    4
    Store B--1--
    5
    Product C--<All Stores>--
    1
    Store A--1--
    6
    Note that only the bold lines are shown in the report,. If you click on the bold line, then the breakdown of the stores is shown. For the above example, I am showing the Top 2 units across all stores (so Product C is not shown at all), but there are actually 5 records, so if I used a formula where RecordNumber <=N, where in this case N=2, I would get a total units sold of 1 + 3 (records 1 and 2) which is incorrect.
    I will have more of a think on this and see if I can find a solution, in the mean time, any other suggestions ? Is there some wya of checking if the line is visible maybe ?
    Thanks for your time !
    Paul

  • Scheduled Report Failing - Don't Know Why

    I'm trying to re-create a scheduled report on CMC that had gotten deleted. It ran before (sometimes multiple times...) but at least it ran. I'm duplicating all the settings for this report based on how they were before, but every time I try to get the report to run, it fails.
    I don't know enough about this to be able to embed any kind of error messages in the e-mail notifications we get. All I know is that no matter what I change/tweak/adjust, we get an email saying "This report has failed to run."
    What kinds of things should I be looking at to troubleshoot? I know the report itself is fine, as users can view it normally (as in, through other viewers). There's definitely something specific to the scheduling process that is not correct, but I don't know what to look at.
    Here is how the scheduling is currently configured:
    Schedule > Main Tab
    -Run Weekly, Tues - Sat
    -Start Date: 10/01/08, 8:30 AM (I originally set this up yesterday, so today at 8:30 should have been the first time it ran, but instead it failed)
    -End Date: 10/01/18, 12:00 AM
    -Number of retries allowed: 0
    -Retry interval in seconds: 1800
    Schedule > Notification
    -Email notification based on: a job has failed to run
    -Message: Report failed to run. Scheduled Report: %SI_NAME% - %SI_STARTTIME% What other codes can we put in this message, BTW? I've been trying to look for something to return error codes, but %SI_OUTCOME%, %SI_STATUSINFO%, and %SI_ALERT_MESSAGE% don't display anything, they just print on the email
    Schedule > Destination
    -Destination: Email (SMTP)
    -Clean up instance after scheduling is checked
    -We have "Set the values to be used at schedule time here:" populated with our list of email addresses for recipients
    -Attach object instance to email message is checked
    -Specified file name: %SI_NAME%%SI_STARTTIME%.%EXT%
    -Add extension is checked
    Schedule > Format
    -Format: Microsoft Excel (Still fails if we choose Excel Data Only or Adobe Acrobat)
    -Use options saved with report is checked (Still fails if we deselect this)
    Schedule > Schedule For
    -Schedule only for myself.
    Could really use some help here, as I don't know what in the world could be causing this to fail. Thanks in advance.

    First thing is to forget all the complex configs and just try to schedule the report to run once now, no alerts, no notifications, no nothing.
    Does that work?
    Then you can build up the schedule, to see where the problem is coming from.
    Sincerely,
    Ted Ueda

  • Measure SUM vs. SUM(measure)

    Problem solved, it was another reason!
    Hello,
    I have a problem I don't understand. What is the different between using "measure SUM" and "SUM(measure)"? If I use it alone it will both give me correct results, if I use it in another formula the results are different:
    sum(m1) = 2
    sum(m2) = 1
    sum(m1) - sum(m2) = 0 <-- that's wrong
    m1 SUM = 2
    m2 SUM = 1
    m1 SUM - m2 SUM = 1 <-- that's correct, but what is different?
    Thank you
    Tobias
    Message was edited by:
    toki

    It was a strange kind of problem and unfortunately i cannot regenerate it well.
    First there was a calcalation (sum(m1) - sum(m2)) which was accumulated. The sum did not return exaclty the correct value. Then, i tried several formulas, sums, drills I cannot remember all combinations and changed the formula to m1 SUM - m2 SUM and it worked fine. Then, after my posting here I rubbed my eyes as I saw that m1 SUM - m2 SUM now did also returned the wrong result.
    I cannot explain this behavior, however, the lost values were caused by NULL-values in some rows (e.g. 5 - NULL = NULL, it should by 5 - 0 = 5), so I added a CASE WHEN m2 IS NULL THEN 0 ELSE m2 END.
    Tobias

  • Can I insert pretest questions as knowledge checks between content slides and before a graded quiz without affecting the scoring of the graded quiz? Help documentation states that they should be used before a course begins.

    Can I insert pretest questions as knowledge checks between content slides and before a graded quiz without affecting the scoring of the graded quiz? Help documentation states that they should be used before a course begins.
    If I use both pretest questions and graded questions, can I also include remedial with return to quiz for both?

    Sorry, but I gave two workarounds: my preference is custom question slides, but you can also have questions slides where you do not add the score to the Total score. They will not be reported to the LMS and can act as Knowledge slides. Only some quizzing system variables can count all question slides, including the Knowledge slides, but the core variables (score, maximum score, percentage) will be correct. Here some links to my blog, that could help you:
    System variables in Captivate 8 - Captivate blog
    Intermediate Score Slides - Captivate blog
    That each SCORM module can have only one quiz is a SCORM requirement, not a a Captivate specific feature. Camtasia is bit difficult to compare, it is not a fully blown authoring tool although the best video screen capture tool around (video is non interactive by definition). I don't use Storyline, but cannot imagine that they shouldn't create SCORM-compliant files.

Maybe you are looking for

  • HOW CAN I REDEEM AN ITUNES GIFT CARD IN THE US BOUGHT IN CANADA?

    HOW CAN I REDEEM AN ITUNES GIFT CARD IN THE US BOUGHT IN CANADA?

  • XML Data File With Namespace

    Hi, I'm trying to create a template with the below xml data file. However, I'm struggling to get any of the field to show up in the report output. Does any have the same issue? <ns0:getCommunityPhaseMasterResponseElement xsi:type="ns0:CVO_CommunityPh

  • How to use CVS with JDeveloper

    Hi all! I'm starting a new project and I would like to know how to use CVS with JDeveloper. This is my first project where I will have two more people working with me and I don't know what the better approach is. Should I use CVS that come with JDeve

  • Cannot deactivate Printer color management (using ICC)

    Hello. Since i move to Windows 7 - 64bits version, i'm not anymore able to print correctly with Lightroom. If i let the printer to manage completely the color, then it's fine. But in this case i have to use one of the paper recomended by HP. Now, if

  • Backup/restore problem....

    It is regarding a SAP DB 7.4. I have installed and new instance of SAP DB and SQL Studio. I am able to connect to my instance MQA via SQL Studio. I have taken a full back up of database. Total number of records in one the table is zero. I started to