Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Vizlib default date

Hi!

I use the Vizlib calendar extension in an app.

I want the app when open to present data for the previous 5 days .

I use the "Initial Selection" and can set a "Initial Start Date".

What should the formula be in order to present the previous 5 days?

25 Replies
Highlighted
Creator
Creator

Hi!

I've try that but the selected range is removed when the app is closed and opened again

Highlighted
Creator
Creator

Did you try the extension I attached? The vizlib filter doesn't help this problem, but the Simple field select does.

Highlighted
Creator
Creator

Hi!

What should the expression look like in 'Simple field select' -> 'Select this one as default'?

Highlighted
Partner
Partner

Hi Stefan,

As it's an extension, this is only applied on a sheet level, so it will only apply the selection if the sheet it's opened.

Same would happen with the vizlib filter (which has a similar option), or any other extension really.

Cheers,

David

Highlighted
Creator
Creator

Hi!

The sheet has a table that contains data for several weeks. When the app is opened i want to present data for e.g. only the previous 5 days.

If it's possible to do this without using the Wizlib Filter or Calendar it's OK with me.

I need to have a filter since the user should have the possibility to select another date range when they are working with the app.

Highlighted
Partner
Partner

You can certainly do that using the vizlib filter with:2018-08-23_12-48-46.png

If you want to select the last 5 days, just convert that expression into the comma separated dates you'd like to select for the user using Qlik Expressions.

I hope this helps,

David

Highlighted
Creator
Creator

Hi!

Isn't this hard coded dates?

What I need is that it always should show the previous 5 days. I.e  5 days back from the date when the app is opened

Highlighted
Partner
Partner

Hi Stefan,

If you want to select the last 5 days, just convert that expression into the comma separated dates you'd like to select for the user using Qlik Expressions.

You'll have to calculate those dates there, there multiple ways to do it, ie: using concat()

Best,

David

Highlighted
Creator
Creator

Hi!

I don't want to select the last 5 days manually.

I need an expression that always calculates the previous 5 days.

E.g. today (2018-08-23) the result should be 2018-08-22  ->08-18.

Tomorrow the result should be 2018-08-23  ->08-19

Highlighted
Creator
Creator

Try creating variables like

d1 = Date(max(dateField), 'YYYY-MM-DD')

d2 = Date(max(dateField)-1, 'YYYY-MM-DD')

d3 = Date(max(dateField)-2, 'YYYY-MM-DD')

d4 = Date(max(dateField)-3, 'YYYY-MM-DD')

d5 = Date(max(dateField)-4, 'YYYY-MM-DD')

and then use David's format and put:

'd1,d2,d3,d4,d5'

or

'$(d1),$(d2),$(d3),$(d4),$(d5)'