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

Calculated Dimension

Hello Guys,

I am in the process of creating a calculated dimension and stuck with the expression to create the calculated dimension.

I have a variable called 'SelectedDate' and that contains the date a user selects out of a slider/calendar object.

I like the X-scale which is the dimension to display only 30 days back from the selected date. So for instance the user selects March 30, 2010 the chart build upon that dimension shows basically the month of March. If the 15th of March is slelected than it goes from 15th of Feb to 15th of March etc.

Is there a QV function to define a dynamic daterange like this?

How does this expression look like? Examples?

Thanks a lot

Ludwig

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

I think you want this:

if(YourDate<=SelectedDate and YourDate>SelectedDate - 30,YourDate)

Or if you really want a month instead of always 30 days:

if(YourDate<=SelectedDate and YourDate>addmonths(SelectedDate,-1),YourDate)

Then checkmark "Suppress When Value Is Null" for that dimension.

View solution in original post

2 Replies
johnw
Champion III
Champion III

I think you want this:

if(YourDate<=SelectedDate and YourDate>SelectedDate - 30,YourDate)

Or if you really want a month instead of always 30 days:

if(YourDate<=SelectedDate and YourDate>addmonths(SelectedDate,-1),YourDate)

Then checkmark "Suppress When Value Is Null" for that dimension.

Not applicable
Author

Hi John,

Great! Yes, that is what I was looking for.

Thanks again

Ludwig