2017-08-01 57 views
0

我有一張表,它使用另一個表的值作爲查找數據表中的字段。VBA數據透視表類別不正確計數或顯示

[Parameters]是保存查找值和

[Sample Log]是數據表中查找從[Parameters]可能值表。

[Sample Log].exp = SELECT Parameters.Experiment FROM [Parameters]; 
[Sample Log].Type = SELECT Parameters.Type FROM [Parameters]; 

如果我使用[Sample Log]作爲源創建Pivot Chart,並放入類別TypeCount of IDs其中的數據,它會像預期的那樣。

但是,在我的exp字段中,它看起來與全文不匹配,而只是文本的前兩個字母。我的實驗例如GC,GPC,GCMS,UV-Vis,HPLC等等,但是類別標籤僅顯示GC,GP,UV,HP等...和GCMS的數據表中的條目被計爲透視圖上的GC。

這個數字幾乎總結了它的地方,如果我有一些GCMS,它會被計爲GC。我通過將GCMS更改爲GC進行了驗證,ID值的計數保持在36,但是,如果將其更改爲HPLC,則HP計數會增加,GC計數會減少。所以GCMS被計算在GC中。

任何洞察如何控制這種計數行爲?

此問題僅在打開允許在組合框中進行多項選擇時纔會顯示。它在我的表創建第二個exp.Value場,但這並不列出所有的價值觀......

enter image description here

回答

0

期望的結果可以通過修改我的查詢語句重新命名的多值來獲得。值字段。例如,我原來的查詢語句是:

SELECT [Sample Log].ID, [Sample Log].material, [Sample Log].lot, [Sample Log].subDate, [Sample Log].endDate, [Sample Log].Exp.Value, [Sample Log].costCenter, [Sample Log].customer, [Sample Log].Type 
FROM [Sample Log]; 

工作statment是:

SELECT [Sample Log].ID, [Sample Log].material, [Sample Log].lot, [Sample Log].subDate, [Sample Log].endDate, [Sample Log].Exp.Value AS Expirment, [Sample Log].costCenter, [Sample Log].customer, [Sample Log].Type 
FROM [Sample Log]; 

[示例日誌] .Exp.Value AS Expirment