January 13, 2006, 04:52 PM
BethanyMULTIPLE SUBTOTALS
How can I create multiple subtotals one of them being conditional?
TABLE FILE OUTPUT
SUM
AMOUNT
BY TERM
BY TERM_TYPE
ON TERM SUBTOTAL
END
So the output looks like:
TERM TERM_TYPE AMOUNT
T1 A 1000
A 500
B 2000
SUBTOTAL T1 3500
T2 A 2500
B 5000
SUBTOTAL T2 7500
TOTAL 11000
The 2nd subtotal I want to add is a subtotal by term where TERM_TYPE NE 'B', so that in the above example the grand total of this 2nd subtotal category would be 4000.
January 13, 2006, 05:16 PM
ptpCould be a job for FML.
Good luick,
Paul.
January 14, 2006, 02:59 PM
susannahit is a good fml app, i agree with paul.
but you can 'cheat'
define a new variable that equals your amount if and only if termtype is A.
bring this variable into your output matrix with a noprint
then subtotal it, as well.
MYFIELD/D8M MISSING ON=IF TERM_TYPE IS 'A' THEN AMOUNT ELSE MISSING;
...
BY TERM BY MYFIELD NOPRINT BY TERM_TYPE
ON TERM SUBTOTAL
ON MYFIELD SUBTOTAL
..this may not be the exact order or whatever that you want, but you can get the idea.
Any help?
January 16, 2006, 11:30 AM
KameshIf you want specific order, instead of using SubTotal you can use Subfoot.
MYFIELD/D8M MISSING ON=IF TERM_TYPE IS 'A' THEN AMOUNT ELSE MISSING;
...
BY TERM BY MYFIELD NOPRINT BY TERM_TYPE
ON TERM
SUBFOOT
"TERM T1
SUBFOOT
" TERM T2 WHEN TERM_TYPE NE 'B'
Hope this helps.
January 16, 2006, 11:32 AM
Kameshearlier post didn't have the full code.
MYFIELD/D8M MISSING ON=IF TERM_TYPE IS 'A' THEN AMOUNT ELSE MISSING;
...
BY TERM BY MYFIELD NOPRINT BY TERM_TYPE
ON TERM
SUBFOOT
"TERM T1 < TOT.AMOUNT"
SUBFOOT
" TERM T2 < MYFIELD "
WHEN TERM_TYPE NE 'B'
January 20, 2006, 03:55 PM
BethanyThank you all for the suggestions. I had multiple columns being summed so I ended up creating a new calculated column which got to the end result. I will however try these options in the future.
Thanks Again!