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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
roebrich
Contributor III
Contributor III

Default start on calendar filter

Hello,

I'd like to know if there's a simple way I can implement a default start on my calendar filter. I want the default start to be the last 7 days available on the data.

Another option is to limit the chart to the last 7 days, but the limit should be lifted if the user selects more than 7 days on the filter.

Thank you!

Roebrich

1 Solution

Accepted Solutions
roebrich
Contributor III
Contributor III
Author

Thank you for the responses, I found exactly what I need on this link: https://www.youtube.com/watch?v=UTDyO68BYL8

View solution in original post

5 Replies
Anil_Babu_Samineni

Could be this?

Use this in your Max arbitrary from calendar properties

If(GetFieldSelections(DateField)>=7, Max(DateField)-7)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
roebrich
Contributor III
Contributor III
Author

Thank you for your response. I tried your suggestion, here is what I did:

1. Created a variable to hold my date field.

2. Changed my calendar filter to look at the variable I just created

3. I edited the max value to be "=If(GetFieldSelections(opened_at_date)>=7, Max(opened_at_date)-7)"

4. min is set to 0 (this was the default after I selected variable).

After applying the steps above, clicking on the filter makes the application not respond. Anything I'm doing wrong?

**Also side note, a new requirement has arrived and instead of the original on my post, we should now have 2 filters using the same field which will determine the start and end date. Start date should be defaulted to day 1 of the current month and end date should be today's date

Anil_Babu_Samineni

I haven't seen any variable in your 3rd statement. if not required, What is the use of 2 variables?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Kushal_Chawda

create a flag in calendar like below

if(today() - Date <= 7,1,0) as Last7DaysFlag


Now you can use the expression in chart


sum({<Last7DaysFlag={1}>}sales)

roebrich
Contributor III
Contributor III
Author

Thank you for the responses, I found exactly what I need on this link: https://www.youtube.com/watch?v=UTDyO68BYL8