Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
claudiamtz01
Contributor II
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

29.PNG

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

30.PNG

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

1 Solution

Accepted Solutions
jensmunnichs
Creator III
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.

View solution in original post

5 Replies
trdandamudi
Master II
Master II

May be as below:

Expression:

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

claudiamtz01
Contributor II
Contributor II
Author

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

trdandamudi
Master II
Master II

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

jensmunnichs
Creator III
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.

claudiamtz01
Contributor II
Contributor II
Author

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

Thank you both!