I'm looking a way to use a variable in a expression of a measure from a line/combo chart.
I tried with defining a variable : vChosenField = [Field] from system fields table ==> $field
and then trying to call the variable in my line chart: $(vChosenField)
but whatever the way, it doesn't seems to be correct.
Got an hint ?
as far as I know
A variable can have one value.
For example, $(vChosenField) = [1,2,3,4,5] array is not possible.
If you do a variable = [field], the value of the variable is array.
If you choose one of the field values for the variable, variable extension will work normally.
For example, $(vChosenField) = max([field])
If it's not the answer you want,
Upload the sample qvf file for further analysis.
I'm trying to build a graphic wich adapt function of what is selected inside a filter panel( fields).
i want a variable to getFieldName([$Field]) ( field wich will be selected)
and the expression of my measure ( from a combo chart ) calling the variable to be able to switch from one graphique to an other by only selecting FieldName, fom a filter panel...
I found lot of similar question, solved for qlik view, unsolved for sense ( getFieldName existe nly in q.view)
it doesnt seems to be so ez...
for your variable you can try this function:
which returns a string with the current selections in a field. Just be aware that in your case it seems like you should let the user select just one single field value at a time.
Step 1: create a inline field which will be the list of fields you want to show i.e.
Load * inline [
Step 2 : Take a filter pane form the chart menu & add the dimension "FieldFilter"
Step 3 : go to the chart & add the mesure you want to add example, =sum(sales)
Step 4 : in dimension =getFieldSelection(FieldFilter)
Step 5 : go to fields section seach for "FieldFilter" & right click Field Settings it select always one selected option (this will ensure that you get only one selection for that field)
Step 6 : you can use Hide Prefix to hide that field
-----------Refer the attached Qlik Sense Application-----------
Thanks for the suggestions. I did tried GetFieldSelection (FieldName) , as a variable and also simply put it in the chart expression and it kinda work .. but nah it ain't.
Instead giving me the values of my field , its returning the field name over and over again. Giving me no charts... How is this a thing
ajaykakkar93 : in your explanation, you specify dimension and measure, i tried something respecting your order and worked but sadly my dimension is always the time and its only my measure which change function of the user
Unixdatetime giving me my dimension, and vMeasure=GetFieldSelections([FieldName]) should giving me the Field Name which have to be applied to Measures and giving me values ( and not field name)
I don't understand why it giving me the string : field name instead of the value of the field name ...
Any hint ?