2014-05-05 54 views
0

我有兩列的表:顯示恆定值,不管數據點的上軸(QlikView的)

我需要它是一個行:

c1 c2 
----- 
a 2 
a 6 
a 10 
b 4 
b 8 

你能和下面的圖式幫助無論c1的值如何,以c1作爲維度的圖表和計算總和的表達式。因此,應該有一條值爲30(= 2 + 6 + 10 + 8 + 4)的單一直線,因此無論c1如何,結果都是恆定的。

我用下面的表達式嘗試:SUM({< c1 = {'*'} >} [c2])

請你說明爲什麼它不工作,什麼是另類?

更多上下文:我還計算了表達式2 = c1按c1分組的總和,以便最後我可以通過執行除法來顯示百分比:expression2 * 100/expression1。 因此會有2個數據點:

爲:18/30

對於b:12/30

任何幫助,十分讚賞。

+0

我想你想exp1的總和(TOTAL c2)和exp2的sum(c2)/ sum(TOTAL c2)? – ralfbecher

+0

謝謝你ralfbecher,我試過了,它工作! – Samy

回答

1

由於拉爾夫寫道總和(TOTAL c2)給出了維數的總和。但你有這些選項:

// Get the total for ALL values, disregarding any selections: 
sum(ALL c2) 
// Get the total for all values in the Dimension using selections: 
sum(TOTAL c2) 
//Get the sum for each value of c1, even when a value is selected (this is similar to sum(c2) when nothing is selected: 
sum({<c1= >} c2) 

然後你可以結合上面得到各種結果。