Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I would like to achieve the following in QlikView:
I have a list box "Parameter" listing all fields by using $Field. If I select one element from Parameter I would like to get min(), max(),avg() for that field in a text box. I tried something like: =max($(=GetFieldSelections($Field))) . But that does not work.
I just want to replace the literal field name by the selected value. How can this be done?
Thank you
hi
try this
='min: ' & $(='min([' & $Field & '])') & chr(10) &
'max:' & $(='max([' & $Field & '])') & chr(10) &
'avg:' & $(='avg([' & $Field & '])') & chr(10) &
'median:' & $(='median([' & $Field & '])')
This should work when you select a single field from the listbox $Field. However, if your field name has space in between, you might have to try like:
=Max($(='['&getfieldSelections($Field)&']'))
Hi,
So it should works if you create a variable V_selected_field
=GetFieldSelections([$Field])
Use this var in the text box with : =max($(V_seleted_field))
Just put this in a variable Variable1=GetFieldSelections($Field) and use something like
max($(Variable1))
HI Tobias,
try below expression
=max({<$Field={$(=GetFieldSelections($Field))}>} $(vNew))
where vNew is a variable (vNew=getFieldSelections($(Field))
Unfortunately, that does not work for me. The result is empty.
This appears to work ... almost. If I apply the formula to avg() and max() the result is plausible.
However, for min () it is not. Is there a way to display all values that contribute?
I tried to make a table based on GetFieldSelections() but obviously I have not grabbed the mechanics of referencing right.
OK. I got it now. My Diagram does not show all values for some reason.
so =Max($(='['&getfieldSelections($Field)&']')) solved my problem.
Thank you very much.
Actually, I am still missing something. I get wrong values for min, max, avg.
What I did not mention before is that I have a second selection "ModelName" in a list box. Maybe this has an impact.
I have a line diagram and list box showing the selected values consistently if I select a ModelName and a Field.
But the aggregations do not reflect the values that I see in list box like a higher Max than any value in the selected list.
It appears that Max is also not global: If I deselect all ModelName then I get different values than when selecting one.
Do I have to explicitly filter for Model and how do I do it?