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: 
dhasharadh
Creator III
Creator III

How to over come the default selection in Qliksense

Hi All, 

in my Line chart am showing last 3 years of data, 2022 , 2021, 2020 in 3 different lines, within the date range from 2020 to 2022 all the date selections applied are working fine. here my requirement is when I select 2018 as well it should reflect in my line chart. so i want these 3 years of data as default selection when no other data filter is selected and when other data filter is selected it should respond accordingly.

Which expression i have to use in order to achieve the above. please suggest is it possible even

My 3 expressions and dims are :

CY - (2022)

if(Count({< Inflow_Date =  {">=$(=Date(Yearstart(Today()),'DD.MM.YYYY')) <=$(=Date(Today(),'DD.MM.YYYY'))"} >}Id) > 0, 

Count({< Inflow_Date =  {">=$(=Date(Yearstart(Today()),'DD.MM.YYYY')) <=$(=Date(Today(),'DD.MM.YYYY'))"} >}Id))

 

PY : (2021)

Count({< Inflow_Date = {">=$(=Date(Yearstart(Today(),-1),'DD.MM.YYYY'))<=$(=Date(Yearend(Today(),-1),'DD.MM.YYYY')) "}>}Id)

PPY : 2020

Count({< Inflow_Date = {">=$(=Date(Yearstart(Today(),-2),'DD.MM.YYYY')) <=$(=Date(Yearend(Today(),-2),'DD.MM.YYYY')) "} >}Id)

Dim : Month(Inflow_Date)

 

Thanks much in advance.

 

3 Replies
rubenmarin

Hi, I think there is no option to hide line as it is in a table, would be nice if they add the option.

So far the closest I think is to chek with if and only return value when the sleected year is lower than 2020, something like:

If(GetSelectedCount(Inflow_Date)>0 and Min(Year(Inflow_Date))<2020, Count({< Inflow_Date = {">=$(=Date(Yearstart(MakeDate($(=Min(Year(Inflow_Date))))),'DD.MM.YYYY')) <=$(=Date(Yearend(MakeDate($(=Min(Year(Inflow_Date))))),'DD.MM.YYYY')) "} >}Id)

It will be shown on legend, I don't know how to hide that

dhasharadh
Creator III
Creator III
Author

Thanks for the reply. Yes as we don't have the option to hide, any other way to do this. 

@sunny_talwar @rwunderlich any other experts please suggest.

rubenmarin

Hi, instead of 3 different expressions you can add year as dimension (maybe you also need to create the field in script) and use only one expression, the expression can be:

Count({<YearField+={2020,2021,2022}>}Id)