Showing results for 
Search instead for 
Did you mean: 

IN formula field HOw to check sub group changing in a group

Former Member
0 Kudos


IN formula field How to check  sub group changing in a group

In my report each group divided into subgroup and in each subgroup i am calculating discount on some value

I have a  formula field in subgroup its calculating  discount of some value 

here my problem is i want to show sum of discount values in group footer of each sub group

but in my formula how i check sub group changing

This is the formula in group footer 2


@Discount :

(({tbl_1e.ID_P_Discount} / 100) * {#Pub_TotalAmount})


and i created a formula field in same footer 1 and suprressed


numberVar B:=B+{@Pub_Discount};


In Footer1 in group



here i need sum  of every subgroup discount separately for each  group

Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

To get the start of a new group use Previous() to get the end of the current group use Next().

So, for example, to get the sum of the discount values, here is a sample for you to work from:

NumberVar totalDiscount;

//initialize totalDiscount at the beginning and for each change of Group 1 field.

if PreviousIsNull({group1 field}) or {group1 field} <> Previous({group1 field}) then totalDiscount := 0;

//Add the discount at the end of each Group 2

if {group2 field} <> next({group2 field} then

  totalDiscount := totalDiscount + {@Discount};