سؤال

I have a table with two columns:

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

Can you help with the following chart expression:

I need it to be a line chart with c1 as dimension and an expression that calculates the overall sum, regardless of the value of c1. Hence there should be a single straight line with a value of 30 (=2+6+10+8+4), so the result is constant regardless of c1.

I tried using the following expression: SUM( {< c1 = {'*'} >} [c2] )

Would you please suggest why it doesn't work and what is an alternative?

More context to this: I also calculate expression2 = the sum of c2 grouped by c1, so that in the end I can show the percentages by doing a division: expression2*100/expression1. Hence there will be 2 data points:

for a: 18/30

for b: 12/30

Any help, much appreciated.

هل كانت مفيدة؟

المحلول

As Ralph writes sum(TOTAL c2) gives the total for the dimension. But you have these options:

// 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)

You can then combine the above to get various results.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top