Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

dynamic date range dimension

I have the following dimension on a line chart and i was looking for a way to make this dimension a dynamic 12 months. 

month([Work Entry Month]) & ' ' & year([Work Entry Month])

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

What exactly do you mean by a dynamic 12 months? do you mean the most recent 12 months?

Could achieve this a number of different ways. I am sure you could make it work somehow using dimension limits or you could just use set analysis in your expression, such as:

avg({<Date={'>=$(=addmonths(max(Date),-12))'}>}Grade)

Or if you want it as a dimension, then maybe like:

=if(Date>='$(=addmonths(max(Date),-12))', Date)

or

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

But this would depend on if your date is in date format or not. I would suggest creating a Month-Year Field in your loadscript. Then use something like above for you set analysis. If this doesn't help, can you explain more, or maybe even attach a sample app that demonstrates your problem/what you are attempting.

Hope this helps!

View solution in original post

2 Replies
jerem1234
Specialist II
Specialist II

What exactly do you mean by a dynamic 12 months? do you mean the most recent 12 months?

Could achieve this a number of different ways. I am sure you could make it work somehow using dimension limits or you could just use set analysis in your expression, such as:

avg({<Date={'>=$(=addmonths(max(Date),-12))'}>}Grade)

Or if you want it as a dimension, then maybe like:

=if(Date>='$(=addmonths(max(Date),-12))', Date)

or

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

But this would depend on if your date is in date format or not. I would suggest creating a Month-Year Field in your loadscript. Then use something like above for you set analysis. If this doesn't help, can you explain more, or maybe even attach a sample app that demonstrates your problem/what you are attempting.

Hope this helps!

Not applicable
Author

thanks for the help.  I was looking for the latest 12 months and used the following dimension.

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