# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for
Did you mean:
Highlighted
Creator II

## Percentage of subtotal with dynamic dimension

I have a chart that calculates value in percentage of subtotal.

It is possible for a user to select what dimensions are used in that chart. Besides that, it is possible to change the order of the dimensions. Now I want the percentage to be calculated only for the last (lowest) dimension in the chart.

Number of selected dimensions can differ.

Is there something to determine what the lowest level is in the chart and do something like :

sum(value)/Sum(Total <lowest dimension> value) ?

1 Solution

Accepted Solutions
Highlighted
MVP

Check attached

11 Replies
Highlighted
MVP

## Re: Percentage of subtotal with dynamic dimension

There should be a way to do it... How exactly are you changing the dimensions dynamically?

Highlighted
Creator II

## Re: Percentage of subtotal with dynamic dimension

I have made a table with dimensions and put that in a listbox.

In my chart I added all possible dimensions and added a condition to every dimension :

=SubStringCount('|' & Concat(distinct Dimensions, '|') & '|', '|Fieldname|')

Borrowed from this community too 🙂

Highlighted
MVP

## Re: Percentage of subtotal with dynamic dimension

May be an if condition checking from the last dimension you have in your chart to see which one is available and use that in your expression using a dollar sign expansion

Highlighted
Creator II

## Re: Percentage of subtotal with dynamic dimension

Because user can change the order of dimensions in the chart, and the number of dimensions can change I don't know how to check what is the lowest /last dimension. It is not necessarily the last selected dimension

Highlighted
MVP

## Re: Percentage of subtotal with dynamic dimension

May be this

``\$(='[' & GetObjectField(Max(Dimensionality())) & ']')``

Highlighted
Creator II

## Re: Percentage of subtotal with dynamic dimension

Thank you for this. I'll try this to implement this in a expression.

Highlighted
Creator II

## Re: Percentage of subtotal with dynamic dimension

This does not work. The result of GetObjectField(Max(Dimensionality())) uses the order of dimensions in "used dimensions" whether the condition to show the dimension  is met or not.

Highlighted
MVP

## Re: Percentage of subtotal with dynamic dimension

I am not sure I follow... would you be able to share a sample to show the issue?

Highlighted
Creator II

## Re: Percentage of subtotal with dynamic dimension

Please see attached file. I hope this makes clear what my goal is