Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Chart Title - Current Selections

Hello all -

I'd like to make my chart title reflect the current selections across two variables (which I have named SubSegment and SubAgency in my dataset).  Ideally, the chart title would read:

"SubAgency - SubSegment, $M"

If there is no SubAgency or SubSegment selected, I'd like it to still output whatever IS selected, and if there are multiple selections, I'd like it to default to "Multiple Selections, $M".  Finally, if nothing is selected (I.E I'm just looking at the total sum of my data), I'd like to display, "Total Market, $M"

Any ideas?  Thanks!

1 Solution

Accepted Solutions
Colin-Albert

Also  GetSelectedCount(fieldname)

View solution in original post

13 Replies
Colin-Albert

GetCurrentSelections()      will return a list of the selected values for all fields

GetCurrentSelections(fieldname)      will return a list of the selected values for one field


Colin-Albert

GetCurrentSelections() will insert each field on a separate line, you can remove the carriage returns like this.

REPLACE(REPLACE(GetCurrentSelections(), CHR(13), ' '), CHR(10), ' ')

Not applicable
Author

Many thanks, Colin.  Any idea how to deal with "Multiple Selections"?  Is there a way to essentially say, "If current selections > 1, then ______"?

Colin-Albert

Have a look at  only(fieldname)  this will return the field name if one selection has been made, otherwise null.

Colin-Albert

Also  GetSelectedCount(fieldname)

Not applicable
Author

So right now I've got:

=IF(GetSelectedCount(SubAgency)>1 or GetSelectedCount(SubSegment)>1,'Multiple Selections, $M',SubAgency&' - '&SubSegment&', $M')

Which is correctly labeling the graphs when I make my singular selections, but is not working when I make multiple selections.  Any ideas what's wrong with my syntax/construction?

maxgro
MVP
MVP

see attachment

=IF(GetPossibleCount(SubAgency)>1 or GetPossibleCount(SubSegment)>1,'Multiple Selections, $M',

SubAgency & ' - ' & SubSegment & ', ' & num(round(sum(Expression1)/1000000),'#.##0') & ' $M')

Not applicable
Author

Massimo - the problem right now isn't getting the last part of the IF function - the Else - to work, it's getting the Condition and the Then.  It's not displaying "Multiple Selections, $M" when I select more than one SubAgency or SubSegment.

swuehl
MVP
MVP

So what it its showing? Have you tried any other text just for testing?

Note that you need active selections in these fields, just making no selection will execute the Then branch (But Massimo's solution using GetPossibleCount() should do this).