6 Replies Latest reply: Feb 2, 2016 8:09 AM by Steve Nase

# Set analysis only when field has no selection

I've been trying hard to figure this out and it seems simple to me, I'm convinced there's something I'm missing.

I want to do set analysis on a chart; for example Sum({\$ <Year={'2016'}>}TRI) unless there's a selection in the "year" field.  So basically I want the chart to default to the sum of TRI where year is 2016 UNLESS the user has a selection in year.  I've thought of a few workarounds that I don't like, but I'm convinced there must be a way to do exactly what I'm after... Any help is appreciated.

Thanks,

Steve

• ###### Re: Set analysis only when field has no selection

Try this:

=Sum({\$<Year = {\$(=If(GetSelectedCount(Year) = 0, 2016, Concat(Year, ',')))}>} Sales)

• ###### Re: Set analysis only when field has no selection

Hi,

or you can try below

if(getselectedCount(Year)=0,sum({<Year={'2016'}>}Sales),Sum(Sales))

Regards,

• ###### Re: Set analysis only when field has no selection

is 2016 the max Year?

do you always want to display 1 year?

sum({\$ <Year={\$(=max(Year))}>} TRI)

• ###### Re: Set analysis only when field has no selection

I'm assuming that you only are looking at yearly aggregations?

If so, this should work.

=Sum({\$ <Year = {'\$(=Max(Year))'}>}TRI)

It will give you the the sum of whatever year is selected and 2016, the max year, if no selection is made.

• ###### Re: Set analysis only when field has no selection

All,

I think Steve wants the default to 2016 and if some thing is selected in  the year then the sum should be calculated on the selections, I would go with Sunny's suggestion but one thing , is 2016 a constant or that is a max among the years.

• ###### Re: Set analysis only when field has no selection

Kiran,

Thanks for the reply.  I do want to default to current year, but 2016 is not the max.  There's other data in the dashboard that has dates of 2017, which is the problem I run into when trying to use max().

I'll use Sunny's or Max's suggestion, which I had thought of, but was hoping there was a cleaner way of doing it. This way works!  Thanks for everyone's input.