Announcements
MAINTENANCE ALERT: Dec. 12th starting 9 AM CET. Community will be read-only. GET DETAILS
cancel
Showing results for
Did you mean:
Contributor II

Go back 30 days from selection in expression

I have a Business_Day field. If the user selects one date, I need the prior 30 days from the selected date as a dimension on a graph.

For example, if I select 10/01/2018

I would expect to see on my graph the dates between 09/01/2018 and 10/01/2018. Something like this:

I need it as a calculated dimension on my graph. Any ideas?

1 Solution

Accepted Solutions
Creator III

Add Business_Day as a dimension, don't use a calculated dimension. Then use Thirumala's expression as an expression, and replace the Date in both Max(Date) functions with your date field (Business_Day) (ONLY the 'Date' in the Max function, the other ones are functions). Next replace 'YourField' with the field you want summed in your chart. You can replace Sum with Count or whatever if necessary. If your expression is more complex than a simple sum or count, you'll have to post it and we'll see if we can help.

5 Replies
Master II

May be as below:

Expression:

Sum( {<Date={">=\$(=Date((Max(Date)-30))) <=\$(=Date(Max(Date))) "}>} YourField )

Contributor II
Author

If I add that expression as a dimension I get an 'Error in Calculated Dimension' on my graph.

Master II

If you share a sample it will be easy to take a look...

Creator III

Add Business_Day as a dimension, don't use a calculated dimension. Then use Thirumala's expression as an expression, and replace the Date in both Max(Date) functions with your date field (Business_Day) (ONLY the 'Date' in the Max function, the other ones are functions). Next replace 'YourField' with the field you want summed in your chart. You can replace Sum with Count or whatever if necessary. If your expression is more complex than a simple sum or count, you'll have to post it and we'll see if we can help.

Contributor II
Author

Thank you Jens for your explanation. Now I get it. It is working fine.

Thank you both!

Community Browser