Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jwaligora
Creator II
Creator II

Toggle Smallest and Largest X values in a chart

Hi,

I have a chart that uses discrete, variable-stored dimensions: =[$(vDim)]

I have a 'Sort Toggle' button (toggles vSortOrder variable), which switches the sort from Descending to Ascending. Chart Sort tab: by Expression, Descending, = if(vSortOrder='desc', count({$} DISTINCT ID), -count({$} DISTINCT ID))

I have a 'Show Top X' button (toggles vDimLimit variable) that switches the Dimension Limit from X to 0 (no limit). Chart Dimension Limit tab: Show Only LARGEST, = if (vDimLimit<> 0, vDimLimit, 1000)

This works lovely for the Show Only = LARGEST and Show Only = SMALLEST settings, but I'm not sure how to let the end-user toggle between the two options. Reversing Sort Order doesn't actually impact which end of the data is shown when the dimension is limited, it just flips the order in which the LARGEST (or SMALLEST) X values are displayed. I tried playing with the Sort Oder = FIRST option, but for the life of me I can't figure out what it's doing.

...there are few more complicating factors present, like extra dimensions and expressions, but I'm hoping they don't impact potential solutions to this issue. 

Labels (5)
1 Solution

Accepted Solutions
sunny_talwar

Will go into the expression....

For top 10 -> If(Rank(Expression) < 11, Expression)
For bottom 10 -> If(Rank(-Expression) < 11, Expression)
For all - > Expression

View solution in original post

6 Replies
sunny_talwar

It might be easiest to help if you are able to share a sample where we can see the setup?

jwaligora
Creator II
Creator II
Author

Hi,

I can't share the actual file, meanwhile generating a simplified sample is a last resort on account time required to do so. 

What if we just ignore the details and focus on the question:

"How to configure a chart (bar graph) to allow the end-user to switch between (1) Show all data (2) Show largest 10 data points (3) Show smallest 10 data points?"

sunny_talwar

I would use an if statement with rank to determine top 10 and bottom 10 and all would be everything

jwaligora
Creator II
Creator II
Author

Do you have an example of using rank with an expression? Does the if statement go into the Dimension or into the Expression tab of the graph?

sunny_talwar

Will go into the expression....

For top 10 -> If(Rank(Expression) < 11, Expression)
For bottom 10 -> If(Rank(-Expression) < 11, Expression)
For all - > Expression

jwaligora
Creator II
Creator II
Author

Perfect. Thank you! 

...I didn't realize the If() function would actually process though the Expression in a for() loop manner thus limiting the Expression itself; thought it was a boolean all-or-nothing assessment.