Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Limiting the date range in the dimention in a Line Chart

Hi All,

I am trying to restrict the range of dates appearing on the X axis of a Line Chart.  on X Axis where as I have 2 years month end dates in the back end data file which is getting loaded.

I have defined 6 variables which will get me the data of the last 6 month ends. Now I am trying to put those variable on the dimention so that only those last 6 month end dates appear in the X axis.

Can anyone help me in providing the expresion that should be used to do it..?

Thanks Guys in advance

Cheers..

Paul

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Hi Paul,

I wouldn't use variables for that, but maybe a calculated dimension (you could also use set analysis in your expressions to limit the date range, but let's start with a calculated dimension).

I assume you have a field Date with the month end dates and you want to show the last 6 months only.

Then you might try (using this as calculated dimension expression in dimension tab):

=if(Date>= addmonths(today(),-6), Date)

and also check suppress NULL on dimension tab.

If this is what you want, we can look into doing the same with set analysis, this is probably performing better on large data sets.

Hope this helps,

Stefan

View solution in original post

3 Replies
swuehl
MVP
MVP

Hi Paul,

I wouldn't use variables for that, but maybe a calculated dimension (you could also use set analysis in your expressions to limit the date range, but let's start with a calculated dimension).

I assume you have a field Date with the month end dates and you want to show the last 6 months only.

Then you might try (using this as calculated dimension expression in dimension tab):

=if(Date>= addmonths(today(),-6), Date)

and also check suppress NULL on dimension tab.

If this is what you want, we can look into doing the same with set analysis, this is probably performing better on large data sets.

Hope this helps,

Stefan

Not applicable
Author

It worked like magic..

Thanks Stefan...!!

sergedegosson
Contributor
Contributor

This post is old, but someone might be able to answer. The if(date>='DATE', date) has the side effect of disbeling axis scaling when a filter is active. Is there another way to do this?