Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

macaulay
Contributor

Set general filter when software starts

Dear all,

I have data that goes from 2007 to 2018. But I just want to be shown the data for 2018, but right away from the beginning so there's no room for user's confusion as the data till 2018 is wrong. There's no possibility to exclude this data in the source so QLIK has to do this for me. Of course I could define my fields so, that just values are shown, when the correlating date is > 01.01.2018, but as I already have a filter regarding the date it would be great if there is a possibilty to set it on "Always On". As I will give the operations to other users soon, I would prefer such a function. Is there a possibilty?

Thanks in advance,

Kind regard

Tom

Tags (2)
1 Solution

Accepted Solutions
OmarBenSalem
Esteemed Contributor

Re: Set general filter when software starts

If you can alter your script; do as mentionned by Youssef and import only date related to 2018 and beyond:

sthing like :

load Date,Field1,Field2,...Fieldn from source where Date>='01.01.2018';

With this, we'll be sure to have only the desired date imported and thus shown in our filter/charts

15 Replies
YoussefBelloum
Esteemed Contributor

Re: Set general filter when software starts

EDITED

Hi,

you have two options:

1. use extension (because there is no Triggers yet on Qliksense unfortunately)

2. Filter your data to load only 2018 on the script. (using a where at the end your fact table load, or limit your master calendar )

OmarBenSalem
Esteemed Contributor

Re: Set general filter when software starts

Do you want the dates of Year 2018 to be ALWAYS selected as a WHOLE; or you want to be able to select specific dates in Year 2018 while having only available the 2018 related dates?

macaulay
Contributor

Re: Set general filter when software starts

I want to be able to select specific date, the only condition is that just data since the 01.01.2018 is in general shown.

OmarBenSalem
Esteemed Contributor

Re: Set general filter when software starts

If you can alter your script; do as mentionned by Youssef and import only date related to 2018 and beyond:

sthing like :

load Date,Field1,Field2,...Fieldn from source where Date>='01.01.2018';

With this, we'll be sure to have only the desired date imported and thus shown in our filter/charts

mark6505
Valued Contributor III

Re: Set general filter when software starts

HI Tom,

What Omar has suggested in point two seems to be the best answer.

If you are not interested in seeing this in the app at all, just don't load it.

You can do this by adding a where to your load script.

Something like

Load

     ...,

    Date

FROM Table

WHERE YEAR(Date) > 2017;


Where date is your date field.


Mark

clondono
Contributor III

Re: Set general filter when software starts

You could set a variable to that selects your default date when no selections are made and that will allow dynamic changes of dates once the selections are made. Then you can apply that variable to your charts.

For instance this variable will select last month unless another selection is made in the [Month Year] filter:

if(GetSelectedCount([Month Year])>0,date(MonthName(AddMonths((max([Month Year])), 0)),'YYYYMM'),date(MonthName(AddMonths((max(Today())),-1)),'YYYYMM'))

macaulay
Contributor

Re: Set general filter when software starts

Thanks for the reply, I tried it like you suggested, but get in error concerning the data type. That's what my script looks like now:

Error.JPG

Will this be a solution?:

Solution.JPG

Thanks for the replies!

OmarBenSalem
Esteemed Contributor

Re: Set general filter when software starts

do it in the load part :

load ...

where rechungDatum>='01.01/2018';

select ...

from

ps : are u sure ur dates are written in that format DD.MM.YYYY?

mark6505
Valued Contributor III

Re: Set general filter when software starts

Hi Tom,


There you are loading from SQL, so hands off the clause to the SQL server.

A quick fix might be something like

Where NUM(RIGHT(Rechnungsdatum,4) > 2017;

If you want a full date i would confirm first the date format  of Rechnungsdatum match the format you expect and then it actually be picked up as a date data type.

Mark

Community Browser