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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding 'Start date' and 'End date' to the calendar dynamically

Hi All,

I have a small problem regarding calendar. I have the following fields in the 'Time' table.

Capture_qlikview1.PNG

I have to add two new columns to the this table in the qlikview script.

They are 'start date' and 'end date'.

'start date' should be the April 1 of the current year and 'end date' should be March 31 of the next year.

eg:

for the column with year key=10 start date='1-April-2010' and end date='31-March-2011'.

We should not hard code for each column,

Please suggest how we can modify the script to get the desired output.

Thanks,

Surendra

11 Replies
Not applicable
Author

Wonderful Roberto!!

Thanks a ton!!

=only(
{
1<
//StartDate={'<=$(=time(now()))'},
//EndDate={'>=$(=time(now()))'}
StartDate={"<=$(=date(today()))"},
EndDate={">=$(=date(today()))"}

>}
Year)

That's what I was looking for.

Roberto,

Can you let me know when only() function is used!!

might sound a bit silly to you:)

I'm very new to QlikView and i'm in the process of learning Set Analysis.

Surendra

Not applicable
Author

Hi Surendra-m,

You're welcome.

About the only-function:

This is what the reference manual says about it:

only(expression )

If expression over a number of records, as defined by a group by clause, contains only one numeric value,

that value is returned. Else, NULL is returned.

In my own words

- I use it when the outcome must be exactly one value (if it is more, Null() is returned, which is usually not useful)

- It is an aggregation-function, so you can apply setAnalysis in this function

- I use it for a case like this, where the "logic" is such that when the filters are applied correctly, there is only one record / value to return

For setAnalysis there are good references online; this one I like most of them; I'll attach it here.

If you would have questions on SetAnalysis, I suggest you open a new topic, since that would be offtopic for this one 🙂

Happy learning!