Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
curiousfellow
Creator II
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
sunny_talwar

11 Replies
sunny_talwar

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

curiousfellow
Creator II
Creator II
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
Creator II
Creator II
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
Creator II
Creator II
Author

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

curiousfellow
Creator II
Creator II
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
Creator II
Creator II
Author

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