0

I want to calculate a grand total of those total I get on level break footer group.

Example:

  Item A1 - 10
  Item A2 - 20
  Item A3 - 30
    Total = 60

  Item B1 - 10
  Item B2 - 20
    Total = 30

Grand Total 90

What should I do?

spenibus
  • 4,339
  • 11
  • 26
  • 35

3 Answers3

0

You can use rollup. Hope that helps.

EDIT: Did not recognized that the question is related to JDEdwards so this is how it would be done in Oralce SQL.

 with 
   items as (
      select 'A' as grp, '1' as item, 10 as val from dual
      union 
      select 'A' as grp, '2' as item, 20 as val from dual
      union 
      select 'A' as grp, '3' as item, 30 as val from dual
      union 
      select 'B' as grp, '1' as item, 10 as val from dual
      union 
      select 'B' as grp, '2' as item, 20 as val from dual

      )
select case 
         when grouping(grp) = 1 then 'Grand Total ' || grp || sum(val)
         when grouping(item) = 1 then 'Total ' || grp || ' = ' || sum(val)
         else 'Item ' || grp || item || ' - ' || max(val)
       end
  from items
 group by rollup (grp, item)
Benjamin
  • 139
  • 6
0
  1. You should set which fields of your Business View you will sequence. For instance, Branch/Plant(MCU) / Date Transaction(TRDJ) / Item (LITM)
  2. Define which of these fields you want a Level Break.
  3. Then create a Level Break Footer Group Section based on the field you defined on the previous step and add an aggregation function to sum the amount fields you want.
lhdv
  • 146
  • 1
  • 6
0

I assume you have more than 2 sort columns. Let us assume them to be MCU(Business Unit),DOCO(Order No),LITM(Item Number)

  1. You will get your subtotal by putting a level-break footer on DOCO and using the aggregate function (sumof) on BC LITM (The item needs to be displayed in the parent section)

  2. To get Grand Total, you can do 2 things:

a: Make a global variable and store the subtotal in it and keep adding it to itself. (Display it at the end as Grand Total)

b: Add a level-break footer (on MCU) inside the existing level-break footer and perform sumof on BC LITM

I hope this solves your problem :)