Dim g As New CrossTableBuilder("统计表1", DataTables("表A"))
g.HGroups.AddDef("部门")
g.HGroups.AddDef("分类")
g.VGroups.AddDef("年份")
g.VGroups.AddDef("月份")
g.Totals.AddDef("费用", "费用")
g.Totals.AddDef("销售", "销售")
g.Build()
MainTable = Tables("统计表1")
Dim idx As Integer = 0
Dim Products As List(Of String()) = DataTables("表A").GetValues("年份|月份")
For i As Integer =0 To Products.Count - 1
Dim dc As DataCol = DataTables("统计表1").DataCols.Add("费用率" & (i+1),Gettype(Double), "费用_" & (i+1) & "/销售_" & (i+1),Products(i)(0) & "_" & Products(i)(1) & "_费用率")
dc.SetFormat("0.00%")
Tables("统计表1").Cols("费用率" & (i+1)).Move(i * 3 + 4)
Next
[此贴子已经被作者于2020/6/1 15:43:44编辑过]