6 Replies Latest reply: Dec 1, 2015 2:29 PM by Андрей Шепель RSS

    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.

        • Re: Ignoring alternate states in calculated dim
          Stefan Wühl

          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.
          • Re: Ignoring alternate states in calculated dim
            Sunny Talwar

            May be this as your dimension:

             

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

              • Re: Ignoring alternate states in calculated dim
                Андрей Шепель

                thanks..

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

                  • Re: Ignoring alternate states in calculated dim
                    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)

                    • Re: Ignoring alternate states in calculated dim
                      Bill Markham

                      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 )