Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a year list box which shows 2001, 2002, ... 2015. In a chart, I want to control the display by the selection in this year filters. e.g. A chart is shown only when users select certain years.
I can do this for single year by putting this expression in "Conditional" field of Expressions tab in a chart:
if(Year='2005', 1, 0)
However, if I want to display a chart only when user select TWO or more years, (e.g., select 2005 AND 2006), the function doesn't work:
if(Year='2005' and Year='2006', 1, 0)
How can I make this work? Thanks.
hi try this example
sum({<Year={'2005','2006'}>}field)
GetPossibleCount(Year)
or
GetSelectedCount(Year)
or
if(match(Concat(DISTINCT Year, '-', Year), '2013-2014'),1,0)
Hi
you need:
if(Year='2005' Or Year='2006', 1, 0)
HTH
Jonathan
Don't add it to your expression.
"A chart is shown only when users select certain years"
Add to your chart properties in Layout - Show: getselectedcount(year) > 1 (or getselected count >= 2 )
Hi in your chart's properties select Layout then Show -> Conditional. Enter the following code. The chart will only be displayed when more than 2 years are selected by the user.
=If(GetSelectedCount(Year)>2,1,0)
Thanks but some of my selections are "AND" case, e.g. "2005" AND "2010".
The match looks like the one I need. Thanks.
This is also helpful, but sometimes I need to check whether the users have chosen the exact years I need, but this function can only check how many years have been chosen.
I think you need this solution:
sum({year = {'$(=GetFieldSelections(year))'}>} <your measure>)