私は、実際の予算と比較して分散を示す簡単な財務テーブルを作成しようとしています。どのようにして2つのデータセット間の分散を得ることができますか?
**Variance**
ID Revenue
1 -20
2 +20
これは私が今の私の二つのテーブルのセットアップを得た方法である:
は // Make the Actual table
DataTable allActual = new DataTable("actualTable");
DataRow rowActual;
// Create columns and add to the DataTable.
allActual.Columns.Add("Title", typeof(string));
allActual.Columns.Add("Revenue", typeof(string));
// Add rows to the Actual grid
foreach (SPListItem item in actualItems)
{
rowActual = allActual.Rows.Add();
rowActual["Title"] = item["Title"].ToString();
rowActual["Revenue"] = item["Revenue"].ToString();
}
// Make the Budget table
DataTable allBudget = new DataTable("budgetTable");
DataRow rowBudget;
// Create columns and add to the DataTable.
allBudget.Columns.Add("Title", typeof(string));
allBudget.Columns.Add("Revenue", typeof(string));
// Add rows to the Actual grid
foreach (SPListItem item in budgetItems)
{
rowBudget = allBudget.Rows.Add();
rowBudget["Title"] = item["Title"].ToString();
rowBudget["Revenue"] = item["Revenue"].ToString();
}
は、私は私を指し内の任意の助けをいただければ幸いです
**Actual**
ID Revenue
1 100
2 120
**Budget**
ID Revenue
1 120
2 100
比べたら、それは私にこのテーブルを与えます正しい答えに。ありがとう。
減算を行うには、データベースでビューを作成することはどうですか? –
データはSharePointリスト内に保持されます。 – regularroutine