Simulating Alternate Dimensions and Measures across multiple visualization objects

    !One of the great things with some Qlik Sense is the ability to specify Alternative Dimensions and Alternative Measures over default Dimensions and Measures on specific visualizations such as a Bar Chart.  This makes it really easy for a consumer of a published app to perform their form of ad-hoc on a specific visualization without having to go into an EDIT mode.

     

    ...but what about syncing an Alternative Dimension or Alternative Measure across several visualization objects at a time?  Or what about some visualization objects that don't offer the Alternative Dimension or Alternative Measure options?

     

    To set this up for your consumers in an app you will publish, a workaround in this case would be to create your own Inline Tables that contain the list of Dimensions or Measures you want to allow for selection as well as creating custom Master Dimension or Master Measures in the App.

     

    As an example, I have a data model that has several fields:

    ie.

    Dimensions:  Customer, Country, City, ProductName

    Measures:  Sales, Expenses, Discount, Gross Profit


    I first create Inline Loads within the Data Load Editor to allow for field selection:

    //Dimensions

    Load * Inline [_dimNo, _dimension

    1, Customer

    2, Country

    3, City

    4, Product];

     

    //Measures

    LOAD * INLINE [_metricsNo, _metrics

    1, Sales

    2, Expenses

    3, Discount

    4, Gross Profit

    ];

     

    I added the _dimension and _metrics fields to the dashboard page.

     

    I then create a Master Dimension called DimSelect with the following logic:

    if (GetSelectedCount([_dimension]) = 1, Pick([_dimNo], Customer, Country, City, ProductName), CategoryName)

     

    The logic specifies that if the Count of the number of dimension values selected within the _dimension field is = 1, pick from a list of which Dimension should be populated into the chart object, else if more than one value is selected or if no value is selected from the _dimension field on the dashboard, default to a specific Dimension field - for me this is CategoryName dimension.

     

    I created a Master Measure called MeasureSelect with similar logic:

    if (GetSelectedCount([_metrics]) = 1, Pick([_metricsNo], sum(Sales), sum(Expenses), sum(Discount), sum([Gross Profit])), sum(Sales))

     

    Here, I want to default to Sum of Sales, else, if a specific measure is selected from _metrics field on the dashboard, that is the measure to use within the chart object.

     

    No I just add the DimSelect and MeasureSelect master items to the Chart Objects I want to use.  Cycling through selection in the fields quickly allows cycling of the Alternative Dimension or Measure across charts.

     

    NOTE:  I've noticed that if I select an item in the chart, multiple selections appear in the Global Selector for all values, not a big deal as I can select/un-select/clear, but think it's something to be aware of when using this method.  Most likely it's due to me using the Pick() function but wanted to highlight that the above does work and addresses the use case.  I'll stop here vs. refining further but if you find solutions to this that allows for ease of selection, please share in comments.