Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am attempting to insert variable text directly into a fieldname within an expression.
Fieldname Examples:
[KPI AltAvg Parameter]
[KPI AltMax Parameter]
[KPI Avg Parameter]
[KPI Max Parameter]
I have created an inline table:
Load *INLINE [
Parameter
AltAvg
AltMax
Avg
Max ];
I've also created a variable called $vParameter that a user can select/set via a selection box.
What I'd like to do is create a measure that looks something like this:
sum('KPI ' & '$(vParameter)' & ' Parameter')
Does this have any chance of working?
Thanks in advance!
May be try this:
Sum($(='[KPI ' & vParameter & ' Parameter]'))
Sum($(='[KPI ' & Parameter & ' Parameter]'))
'[KPI ' & $(vParameter1)& ' ' & 'Parameter]'
in a KPI box does indeed create the correct fieldname = [KPI AltAvg Parameter]
HOWEVER, if I wrap that statement in sum() it breaks.
I have tried creating a Let vParamString = '[KPI ' & $(vParameter1)& ' ' & 'Parameter]' in the loadscript and also in the variable editor (independently).
Unfortunately, the resulting variables don't populate the values and the result of it is the string entered, not the intended variable-created name.
I've also learned that in creating a select box with the Fieldname in it - when I create the associated variable, I simply enter the fieldname in the description. If I attempt to use GetFieldSelections(Fieldname) it fails (with or without preceding =). Leaving just the fieldname does populate the variable accordingly when it is selected, however I'm still unable to get it to work properly
I've scoured the net and apparently no one else wants to do this
Other ideas??
Thanks!
I recommended you using the field instead of a variable, did you try this the field Parameter,instead of vParameter?
Sum($(='[KPI ' & Parameter & ' Parameter]'))
Ok, using that concept, I was able to construct the string, as well as create a variable that returns the correct result!! Almost there.
Now I have:
$vParam = '[KPI' & Parameter & ' ' & 'Parameter]'
so in a KPI box, I can show $(vParam) and it will display
[KPI AltMax Parameter]
Perfect, right!?!
So I got greedy and wrapped a sum() around it. it said 'no'.
I tried: sum($(=vParam)) as well.
Since the result of this variable I wanted to be taken to be literal, I'm assuming I'm missing some syntax here?
How about may be this
Sum($(=$(vParam)))
Or
Sum($(=$(=vParam)))
THANK you. They both actually produced the same, correct result.
I went with the first. That was a stumper - thanks again!
Awesome. I am glad you were able to make this to work. Always a great feeling.
Best,
Sunny
so you have to have a variable to place the string in before doing the sum is that correctly understood or can you actually get the sum without first passing the string to the variable?
I have similar issue and unable to extract the actual field value even when getting the string to look excactly like the field name.