Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Enable Conditional - Refer to the dimension name

Hoping someone might be able to help me out with a problem that I'm trying to solve.  I have a dynamic chart, which allows the user to select the dimensions they want to see in the report.  I have added all the possible fields into the dimensions, and placed a condition on each one.  For example, for dimension "Region" the condition is '=SubStringCount(Concat(_dimension_listing, '|'), 'Region')' and for 'Country' the condition is  '=SubStringCount(Concat(_dimension_listing, '|'), 'Country')'.  We create these types of reports often, and the possible dimensions change from project to project.  Currently, we have to manually update the condition changing the value from 'Country' to 'Region' or any other dimension that is added.  Is there a way to refer to the dimension name within the conditional statement so that we would not need to hard code the 'Country' or 'Region' value? 

In essense what I'm looking for is a formula that would be similiar to .....=SubStringCount(Concat(_dimension_listing,'|'), GET_DIMENSION_NAME), which could then be added to any dimension that was placed in the chart; as long as it appeared in the _dimension_listing as well. 

Any help would be great. 

1 Reply
hugmarcel
Specialist
Specialist

Hi

a possible solution or alternative is to create the dimension name upon user selection or any other selection. Therefore, no
<getDymensionName()> function will be needed:

1.) Put all possible dimensions and their combinations into a list box:


    ("Office", "Salesman", "Office, Salesman", "Salesman, Office") etc.


2.) Select 1 value in the listbox.


3.) In a Pivot, create dynamic dimensions such as:

      =$(=(SubField(GetFieldSelections(DIMENSION),',',1)))
      =$(=(SubField(GetFieldSelections(DIMENSION),',',2)))
      ...
      =$(=(SubField(GetFieldSelections(DIMENSION),',',n)))

      etc.

4.) Set the dynamic dimensions to conditional with

    =len(Subfield(GetFieldSelections(DIMENSION),',',1))
    ...
    =len(Subfield(GetFieldSelections(DIMENSION),',',n))
   
Marcel