Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have 20 fields like A,B,C,D,E,F.... etc.
then i created a inline table to get a dimension with the name above fileds.
i.e.
load * inline[
Filed_Name
A,
B,
C,
D,
E,
F
];
Now i want to create a table. so i write expression like
if(Filed_Name='A',sum(A),
if(Filed_Name='B',sum(B),
if(Filed_Name='C',sum(C).....)
etc.
so i need instead of write separate expression for each dimension value, can i get common expression like below
sum(max(field_Name)) or Sum(only(field_Name)) or can use variable?
how can i get field name from field value?
hi
you can use
=$(='Sum(' & Filed_Name & ')')
Or this:
Sum($[(=field_Name)])
But neither of these will work unless there is one and only one possible value of field_Name (eg by selecting one value from the list).
If you want to display all of them in a table, load the data like this:
FieldDims:
LOAD Dual(field_Name, RowNo()) as field_Name
Inline
[
field_Name
A,
B,
C,
D,
E,
F
];
Create a table with field_Name as dimension, and use the expression:
=Pick(field_Name,
Sum(A),
Sum(B),
Sum(C),
Sum(D),
Sum(E),
Sum(F)
)
Hi Liron,
Thanks for your reply.
But it is not working for me.
my field names are [stress value], [long/short value].
Could it be that your source is a crosstable? If yes it might be easier to transform it into a normal data-structure per The Crosstable Load.
- Marcus
hi
try this
=$(='sum([' & Field_Name & '])')
Hi Liron,
Thanks for your reply.
it is working when we select a value on that field. but i need without making selection of that field can we get the result?
I think this won't be possible because the $-sign expansion will be globally calculated and contained then as an adhoc-variable a single-value - it won't be calculated in respect to any dimensions.
- Marcus
Hi Marcus,
Thanks for your reply.