# Pivot Table Adding Field or Column

#### shah0101

##### New Member
HI EXPERTS,

I HAVE PIVOT TABLE WHICH IS GATHERING DATA FROM TWO DIFFERENT TABLES. RELATIONSHIP IS WORKING FINE (I THINK) BUT I AM STUCK AT ADDING A "FIELD" OR A "COLUMN" TO GET THE RESULTS BY WHICH WILL BE THE END PRODUCT OF DEDUCTION FROM "TABLE 1" TO THE ITEMS OF "TABLE 2". BOTH VALUES ARE ALREADY BRINGING NUMBERS TO THE "PIVOT TABLE".

1) CALCULATED FIELD / CALCULATED ITEM IS GRAYED FOR SOME REASON.

2) TO EXPLAIN WHAT I AM TRYING TO ACHIEVE IS AS BELOW:

A) PIVOT TABLE IS A COMBINATION OF TWO DIFFERENT TABLES. TABLE ONE IS NAMED "LC" AND TABLE TWO IS "INV".
B) "LC" TABLE HAS A COLUMN/FIELD NAMED "AMOUNT" AND "INV" TABLE HAS A COLUMN/FILED NAMED "VALUE".
C) BOTH "AMOUNT" AND "VALUE" FIELDS ARE IN PIVOT TABLE WHICH ARE BRINGING DATA AS I NEED.
D) "AMOUNT" FILED IS DISPLAYED ONCE IN EACH GROUP AND THE "VALUE" FIELD IS REPEATING SEVERAL ROWS UNDER SAME GROUP WHICH IS FINE.
E) NOW I WANT A SEPARATE COLUMN OR FIELD WHERE I CAN DEDUCT THE SUBTOTAL "VALUE" FROM THE "AMOUNT" FIELD. PLEASE GUIDE / ADVISE HOW TO CREATE / ADD ONE? SCREENSHOTS ATTACHED.  ### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.

#### shah0101

##### New Member
HI EXPERTS,

I HAVE PIVOT TABLE WHICH IS GATHERING DATA FROM TWO DIFFERENT TABLES. RELATIONSHIP IS WORKING FINE (I THINK) BUT I AM STUCK AT ADDING A "FIELD" OR A "COLUMN" TO GET THE RESULTS BY WHICH WILL BE THE END PRODUCT OF DEDUCTION FROM "TABLE 1" TO THE ITEMS OF "TABLE 2". BOTH VALUES ARE ALREADY BRINGING NUMBERS TO THE "PIVOT TABLE".

1) CALCULATED FIELD / CALCULATED ITEM IS GRAYED FOR SOME REASON.

2) TO EXPLAIN WHAT I AM TRYING TO ACHIEVE IS AS BELOW:

A) PIVOT TABLE IS A COMBINATION OF TWO DIFFERENT TABLES. TABLE ONE IS NAMED "LC" AND TABLE TWO IS "INV".
B) "LC" TABLE HAS A COLUMN/FIELD NAMED "AMOUNT" AND "INV" TABLE HAS A COLUMN/FILED NAMED "VALUE".
C) BOTH "AMOUNT" AND "VALUE" FIELDS ARE IN PIVOT TABLE WHICH ARE BRINGING DATA AS I NEED.
D) "AMOUNT" FILED IS DISPLAYED ONCE IN EACH GROUP AND THE "VALUE" FIELD IS REPEATING SEVERAL ROWS UNDER SAME GROUP WHICH IS FINE.
E) NOW I WANT A SEPARATE COLUMN OR FIELD WHERE I CAN DEDUCT THE SUBTOTAL "VALUE" FROM THE "AMOUNT" FIELD. PLEASE GUIDE / ADVISE HOW TO CREATE / ADD ONE? SCREENSHOTS ATTACHED.  #### shah0101

##### New Member
If that is not workable is it possible to "add measure" to solve the problem?

Like can we deduct the "subtotal of the group": "lc number" from "amount" ?

#### shah0101

##### New Member
WELL I FINALLY FIGURED IT OUT HOPE IT HELPS OUT OTHERS:

I have two tables: one of customers ("Donor"), and one of transactions ("Trans"). In Donor, I want a "Total" column that sums all the transactions by a particular Donor ID, which I would calculate in a standard Excel table. The key here is to make sure that the relationship between the two tables is correctly configured, and then make sure to use the combination of CALCULATE() and FILTER() -- filtering the trans table based on the current donor context.

FOLLOWING IS WHAT ONE NEEDS TO WRITE:
=CALCULATE(SUM(Trans[Amt]), FILTER(Trans, Trans[Donor] = Donor[DonorKey]))

HOPE THIS HELPS!