×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Calculating a value in the SUBTOTAL

Calculating a value in the SUBTOTAL

Calculating a value in the SUBTOTAL

(OP)
I have a report which requires SUBTOTALS.

The problem starts with the third column which is calculated based off of the 1st and 2nd SUBTOTALS.

Example:

SUBTOTAL_A        SUBTOTAL_B       CALCULATED_VALUE
    55                75                26.66%


Formula is:
((SUBTOTAL_B - SUBTOTAL_A)/SUBTOTAL_B) * 100


Can this be done in the Subtotal area?

Thanks,

Leo   

RE: Calculating a value in the SUBTOTAL

DEFINE FILE CAR
SUBA/I6 = 55;
SUBB/I6 = 75;
END

TABLE FILE CAR
PRINT SUBA
      SUBB
COMPUTE PCT/D6.2 = ((SUBB - SUBA)/SUBB) * 100;
   BY COUNTRY
ON COUNTRY RECOMPUTE
ON COUNTRY SUB-TOTAL
IF RECORDLIMIT EQ 5
END

Returns

PAGE 1  
 
COUNTRY SUBA SUBB PCT

ENGLAND          55  75 26.67
*TOTAL ENGLAND   55  75 26.67
FRANCE           55  75 26.67
*TOTAL FRANCE    55  75 26.67
ITALY            55  75 26.67
*TOTAL ITALY     55  75 26.67
JAPAN            55  75 26.67
*TOTAL JAPAN     55  75 26.67
W GERMANY        55  75 26.67
*TOTAL W GERMANY 55  75 26.67
*TOTAL W GERMANY 55  75 26.67
TOTAL           275 375 26.67

Is that what you were looking to do?

RE: Calculating a value in the SUBTOTAL

(OP)
It appears like what i am trying to do, but I will have many detail records before the subtotals.

I'll try it and let you know.
Thanks.

Thanks,

Leo   

RE: Calculating a value in the SUBTOTAL

(OP)
In other words, the PCT field should be calculated from the SUBTOTALS; not the detail records.

Thanks,

Leo   

RE: Calculating a value in the SUBTOTAL

(OP)
The above code calculated the values for each row, but it's showing the total of the PCT column instead of showing the computed field as the PCT subtotal.

Thanks,

Leo   

RE: Calculating a value in the SUBTOTAL

On the SUBTOTAL line ('ON field ...') do you say SUBTOTAL or SUB-TOTAL, which adds up the COMPUTEd field, or RECOMPUTE/SUMMARIZE, which redoes the calculation, based on subtotaled values?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close