27 Replies Latest reply: May 16, 2018 2:05 PM by Jesse Taylor

# Calculated Dimension with Set Analysis

Hi

I have a set of data from 2015 to 2018 however I will like to create a calculated dimension for a chart that only displays data from 2016 to 2018 but I will also add a filter to the tab where the user can select to see the 2015 data if they want to just won't show in the chart as the default view.

Any help.

Thank you

• ###### Re: Calculated Dimension with Set Analysis

I have a set of data from 2015 to 2018 however I will like to create a calculated dimension for a chart that only displays data from 2016 to 2018

Instead of creating dimension - I suggest you to restrict in expression

Sum({<Year = {2016, 2017, 2018}>} Sales)

but I will also add a filter to the tab where the user can select to see the 2015 data if they want to just won't show in the chart as the default view.

Not entirely sure, But whole expression should look like this

If(GetSelectedCount(Year)=0, Sum({<Year = {2016, 2017, 2018}>} Sales), Sum(Sales))

• ###### Re: Calculated Dimension with Set Analysis

This is the expression I am currently using

=sum({\$<metric_name={'Non-Billable Cost'}>} metrictotal)/sum(hours_units)

How can I adjust this to fit your expression or do you think possibly I calculated dimension will be best. My dimension now is "Year" which is from 2015 to 2018.

• ###### Re: Calculated Dimension with Set Analysis

May be this?

If(GetSelectedCount(Year)=0, sum({\$<metric_name={'Non-Billable Cost'}, Year = {2016, 2017, 2018}>} metrictotal)/sum({<Year = {2016, 2017, 2018}>}hours_units), sum({\$<metric_name={'Non-Billable Cost'}>} metrictotal)/sum(hours_units))

• ###### Re: Calculated Dimension with Set Analysis

This expression worked however the legend still shows 2015 but the lines just show 2016 to 2018. How can I not make the legend show 2015?

Thank you

• ###### Re: Calculated Dimension with Set Analysis

Hi,

How can I apply the same logic to  (sum(revenue)-sum(metrictotal))/sum(revenue)

Tried using

=If(GetSelectedCount(Year)=0, (sum({\$<Year = {2016, 2017, 2018}>} revenue)- sum({\$<Year = {2016, 2017, 2018}>} metrictotal))/(sum({\$<Year = {2016, 2017, 2018}>} revenue)))

but whenever I select 2015 in the filter it gives me no data to display but it should at least display something since the datasource contains data from 2015.

Thank you

• ###### Re: Calculated Dimension with Set Analysis

Hi

=if(Year>2015,Year)

• ###### Re: Calculated Dimension with Set Analysis

This is the expression I am currently using

=sum({\$<metric_name={'Non-Billable Cost'}>} metrictotal)/sum(hours_units)

How can I adjust this to fit your expression or do you think possibly I calculated dimension will be best. My dimension now is "Year" which is from 2015 to 2018.

Are you suggesting I use your expression as a calculated dimension.

• ###### Re: Calculated Dimension with Set Analysis

So if user select 2015 do you want to show sale from 2015 to 2018 ? or only 2015 ?

Br,

KC

• ###### Re: Calculated Dimension with Set Analysis

User can select 2015 data to view it but the default view when all selections are cleared should display data from 2016 to 2018.

• ###### Re: Calculated Dimension with Set Analysis

for you second requirement, you can create a separate chart and set the visibility like if  selected year = 2015, then show the chart with 2015 values.

• ###### Re: Calculated Dimension with Set Analysis

Try like this:

If(GetFieldSelections(Year)='2015',Sum({<Year = {2015}>} Sale), Sum({<Year = {2016, 2017, 2018}>} Sale))

Br,

KC

• ###### Re: Calculated Dimension with Set Analysis

Do you want me to try this as the calculated dimension to as an expressions for the chart?

Thank you

• ###### Re: Calculated Dimension with Set Analysis

Put this in an expression:

If(GetSelectedCount(Year)>0,Sum({<Year = {'\$(=Max(Year))'}>} Sale) , Sum({<Year = {'2016','2017','2018'}>} Sale))

• ###### Re: Calculated Dimension with Set Analysis

This is the expression I am currently using

=sum({\$<metric_name={'Non-Billable Cost'}>} metrictotal)/sum(hours_units)

How can I adjust this to fit your expression or do you think possibly I calculated dimension will be best. My dimension now is "Year" which is from 2015 to 2018.

• ###### Re: Calculated Dimension with Set Analysis

The set Analysis will limit the dimension and the result to 2015 if selected or 2015,2016,2016, you don't need a calculated dimension.

put this in an expression.

=IF(GetSelectedCount(Year)>0,Sum({<Year = {'\$(=Max(Year))'},metric_name={'Non-Billable Cost'}>} metrictotal)/sum(hours_units) , Sum({<Year = {'2016','2017','2018'},metric_name={'Non-Billable Cost'}>} metrictotal)/sum(hours_units))

• ###### Re: Calculated Dimension with Set Analysis

Thank you so much for your quick response. With this expression will the user be able to select and view 2015 data?

• ###### Re: Calculated Dimension with Set Analysis

Yes but just if they select the 2015, if not, they will see from 2016 to 2018.

• ###### Re: Calculated Dimension with Set Analysis

Please see the image. The 2015 line is actually flat now

• ###### Re: Calculated Dimension with Set Analysis

It looks like the values are 0 , use an If Statement then,

Like this,

Javier

• ###### Re: Calculated Dimension with Set Analysis

This expression worked however the legend still shows 2015 but the lines just show 2016 to 2018. How can I not make the legend show 2015?

Thank you

• ###### Re: Calculated Dimension with Set Analysis

ok,

Create an expression for each Year

• ###### Re: Calculated Dimension with Set Analysis

If you want to send me the QVW I can do it for you

• ###### Re: Calculated Dimension with Set Analysis

How can I share it without it giving you an error when you load it.

• ###### Re: Calculated Dimension with Set Analysis

Hi,

How can I apply the same logic to  (sum(revenue)-sum(metrictotal))/sum(revenue)

Tried using

=If(GetSelectedCount(Year)=0, (sum({\$<Year = {2016, 2017, 2018}>} revenue)- sum({\$<Year = {2016, 2017, 2018}>} metrictotal))/(sum({\$<Year = {2016, 2017, 2018}>} revenue)))

but whenever I select 2015 in the filter it gives me no data to display but it should at least display something since the datasource contains data from 2015.

Thank you

• ###### Re: Calculated Dimension with Set Analysis

Hi,

How can I apply the same logic to  (sum(revenue)-sum(metrictotal))/sum(revenue)

Tried using

=If(GetSelectedCount(Year)=0, (sum({\$<Year = {2016, 2017, 2018}>} revenue)- sum({\$<Year = {2016, 2017, 2018}>} metrictotal))/(sum({\$<Year = {2016, 2017, 2018}>} revenue)))

but whenever I select 2015 in the filter it gives me no data to display but it should at least display something since the datasource contains data from 2015.

Thank you

• ###### Re: Calculated Dimension with Set Analysis

do you want particular chart to show default data 2016 to 2018 or whole dashboard?

If you want whole dashboard to show default data for 2016 to 2018 then you can apply document level trigger

or if you want for any particular chart then you can create two different calculated dimension one when user select any of the year then,

expression, sum(sale)

condition,GetSelectedCount(year)>0

and other expression should be,sum({<year={'2016','2017','2018'}>}sale)

condition,GetSelectedCount(year)=0

• ###### Re: Calculated Dimension with Set Analysis

I am looking to have the default view of a particular chart show from 2016 to 2018 but I will also add a year filter where the user can select to see 2015 data if they want to.

This is the expression I am currently using

=sum({\$<metric_name={'Non-Billable Cost'}>} metrictotal)/sum(hours_units)

How can I adjust this to fit your expression or do you think possibly I calculated dimension will be best. My dimension now is "Year" which is from 2015 to 2018.