Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Ignoring alternate states in calculated dim

Colleagues, good evening!

In my model i have one listbox filter (with default alternate  state) and two pivot tables with alternate states State1 and State2.

Both pivots have calculated dim:

=if(GetFieldSelections(Condition)='Reduced','A','B')

But it's working only when i set for them also alternate state "default"

Is there any way to ignore these states in my condition dimension?

Model in attachment.

1 Solution

Accepted Solutions
sunny_talwar

May be this as your dimension:

=If(Aggr(GetFieldSelections(Condition, ',', 10, '$'), Condition) = 'Reduced', 'A', 'B')

View solution in original post

6 Replies
swuehl
MVP
MVP

Not sure if I understood your issue correctly.

In recent QV versions, you can tell QV which state to use for GetFieldSelections():

getfieldselections ( FieldName [, ValueSep [, MaxValues [, State]]])

Returns a string with the current selections in a field. It is possible to query an alternate state.

ValueSep is the separator to be put between field values. The default is ', '.

Maxvalues is the maximum number of field values to be individually listed. When a larger number of values is selected the format 'x of y values' will be used instead. The default is 6.

State is the alternate state to query.

The string that is returned can be in these forms:

   

'x, y,z'If the number of selected values is Maxvalues or less, the string returned is a list of the selected values, separated with Valuesep as delimiter.
'NOT x, y, z'If the number of non-selected values is Maxvalues or less, the string returned is a list of the non-selected values, separated with ValueSep as delimiter, and NOT as a prefix.
'x of y'If the number of selected values is more than Maxvalues, but less than the total number of values (y) less Maxvalues.
'ALL'If all values are selected.
'-'If no value is selected.
<search string>If you have selected using search, the search string is returned.
sunny_talwar

May be this as your dimension:

=If(Aggr(GetFieldSelections(Condition, ',', 10, '$'), Condition) = 'Reduced', 'A', 'B')

Anonymous
Not applicable
Author

thanks..

could you please explaine me what means parameters in fun getfieldselection ',',10, '$' ?

sunny_talwar

Yup

1) FieldName = Condition

2) Seperator = ','

3) Number of observations before it starts giving your number selected = 10 (randomly choose 10)

4) State = $ (Default)

Anonymous
Not applicable
Author

It is explained in the Help.  The $ refers to the Default State.

getcurrentfield (GroupName)

Returns the name of the currently active field in a group.

Example

getcurrentfield( myGroup )

getfieldselections ( FieldName [, ValueSep [, MaxValues [, State]]])

Returns a string with the current selections in a field. It is possible to query an alternate state.

ValueSep is the separator to be put between field values. The default is ', '.

Maxvalues is the maximum number of field values to be individually listed. When a larger number of values is selected the format 'x of y values' will be used instead. The default is 6.

State is the alternate state to query.

The string that is returned can be in these forms:

  

'x, y,z'If the number of selected values is Maxvalues or less, the string returned is a list of the selected values, separated with Valuesep as delimiter.
'NOT x, y, z'If the number of non-selected values is Maxvalues or less, the string returned is a list of the non-selected values, separated with ValueSep as delimiter, and NOT as a prefix.
'x of y'If the number of selected values is more than Maxvalues, but less than the total number of values (y) less Maxvalues.
'ALL'If all values are selected.
'-'If no value is selected.
<search string>If you have selected using search, the search string is returned.

Examples

getfieldselections ( Year )

getfieldselections ( Year, '; ' )

getfieldselections ( Year, '; ' , 10 )

Anonymous
Not applicable
Author

Thank you!