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: 
curiousfellow
Specialist
Specialist

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
sunny_talwar

11 Replies
sunny_talwar

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

curiousfellow
Specialist
Specialist
Author

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 🙂

 

sunny_talwar

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

curiousfellow
Specialist
Specialist
Author

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

sunny_talwar

May be this

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

 

curiousfellow
Specialist
Specialist
Author

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

curiousfellow
Specialist
Specialist
Author

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.

sunny_talwar

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

curiousfellow
Specialist
Specialist
Author

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