Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
juliakhaa
Creator
Creator

How to display data for the last 7 days

Hi all.
Is there any way for qlik sense to always show data for the last 7 days when opening the dashboard in a simple way?
I have a date field (s_date_open) in the format:
17.11.2022 16:00
17.11.2022 19:05
18.11.2022 11:00
etc.
and a filter: Date(FLOOR(s_date_open,'DD.MM.YYYY')) that outputs all unique dates without time.

My solution was to manually select the last 7 dates in the filter and bookmark it, but then later when refreshing the data, it will display not the last 7 days, but the selected ones, so is it possible to do this automatically?

Tried to make a calendar vizlib, but it does not want to work as a filter.

Labels (7)
2 Solutions

Accepted Solutions
Aditya_Chitale
Specialist
Specialist

Follow below steps:

1. create a calendar for max(date) - 7 date values and duplicate the calendar field and give it a different name (eg. date_for_selection)

2. in sheet actions, select "select all values in a field" from dropdown

Aditya_Chitale_0-1669538527145.png

3. choose newly created date field (date_for_selection) from fields dropdown.

Now everytime sheet is opened, by default latest date and past 7 dates will be selected.

Regards,

Aditya

 

View solution in original post

Vegar
MVP
MVP

You could try to filter your date field using an expression. When the filter is active create a bookmark. Make that bookmark a default bookmark,  then it will be applied every time an user opens the application.

Your selection search could look something like this. 

=s_date_open >= Max(total s_date_open) - 6 AND s_date_open< Max(total s_date_open) 

View solution in original post

6 Replies
Aditya_Chitale
Specialist
Specialist

Follow below steps:

1. create a calendar for max(date) - 7 date values and duplicate the calendar field and give it a different name (eg. date_for_selection)

2. in sheet actions, select "select all values in a field" from dropdown

Aditya_Chitale_0-1669538527145.png

3. choose newly created date field (date_for_selection) from fields dropdown.

Now everytime sheet is opened, by default latest date and past 7 dates will be selected.

Regards,

Aditya

 

juliakhaa
Creator
Creator
Author

Thank you so much, I’ll try this one tomorrow and report  back  

Vegar
MVP
MVP

You could try to filter your date field using an expression. When the filter is active create a bookmark. Make that bookmark a default bookmark,  then it will be applied every time an user opens the application.

Your selection search could look something like this. 

=s_date_open >= Max(total s_date_open) - 6 AND s_date_open< Max(total s_date_open) 

juliakhaa
Creator
Creator
Author

Aditya, I'm sorry, I'm not sure I understood the first point correctly.
Do I understand correctly, that I create a calendar widget on the sheet, where I write in the selection field - max(s_date_open) - 7 date values, which I then duplicate in the script under a different name?

thank you,

Julia

vinieme12
Champion III
Champion III

just the first part should suffice in this case

=s_date_open >= Max(total s_date_open) - 6 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Aditya_Chitale
Specialist
Specialist

I guess @Vegar 's solution is more convenient. Just use: =date>=max(total date)-6  in date filter and create a bookmark and in sheet actions select apply bookmark if you want it to be activated only when specific sheet is opened. otherwise set it to default

 

Regards,

Aditya