Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
george55
Partner - Creator III
Partner - Creator III

Trigger in filter pane

Hi all,

Part of my loading-Script:

DateField1,
If(WeekDay(DateField1)<5, 1, 0) as IsWorkDay_DateField1,

Using this expression in the app:

Count({<IsWorkDay_DateField1 ={1}>} %FIELDX)

Worked fine.

Because I have two filter panes per sheet, I am asking if there is a smart solution, avoiding built to much Fields to separate the aggragations 1x with weekend and 1x without weekend. Avoding e.g. having 2 different table objects.

Is there a technique where the aggregation recognize which filterpane is in use? If none, then default it should used one specific. In a further step have to find out how to prohibit using both filter simultaneously, because this makes no sense.

What I expect: When Filter pane 1 is used, all dimensions should caluculate e.g. like this:

Count(%FIELDX)

If Filter pane 2 is in use, then:

Count({<IsWorkDay_DateField1 ={1}>} %FIELDX)

May be there is something like a trigger?

Thanks for any advice

Labels (1)
  • SaaS

1 Solution

Accepted Solutions
y_grynechko
Creator III
Creator III

Hey, you can achieve that by adding a couple of ifs to the calculations. 

if(GetSelectedCount(pane 1) => 1,

Count(%FIELDX),

if(GetSelectedCount(pane 2) => 1,

Count({<IsWorkDay_DateField1 ={1}>} %FIELDX),

if(GetSelectedCount(pane 2) => 1 and GetSelectedCount(pane 1) => 1, null(),

Count({<IsWorkDay_DateField1 ={1}>} %FIELDX))))

 

 

null() - type what you want to do when both are selected

Count({<IsWorkDay_DateField1 ={1}>} %FIELDX)))) - type what you want to do in default state

View solution in original post

7 Replies
y_grynechko
Creator III
Creator III

Hey, you can achieve that by adding a couple of ifs to the calculations. 

if(GetSelectedCount(pane 1) => 1,

Count(%FIELDX),

if(GetSelectedCount(pane 2) => 1,

Count({<IsWorkDay_DateField1 ={1}>} %FIELDX),

if(GetSelectedCount(pane 2) => 1 and GetSelectedCount(pane 1) => 1, null(),

Count({<IsWorkDay_DateField1 ={1}>} %FIELDX))))

 

 

null() - type what you want to do when both are selected

Count({<IsWorkDay_DateField1 ={1}>} %FIELDX)))) - type what you want to do in default state

TimvB
Creator II
Creator II

Why not create the following flag dimension in the script:

If(WeekDay(DateField1)<5, 'Workdays','Weekend') as DayType,

In the filter pane, you just select the field DayType. This will allow users to make the following three selections: (1) Workdays only, (2) Weekend days only, and (3) Workdays and Weekend days.

 

george55
Partner - Creator III
Partner - Creator III
Author

Would like to implement it.2  questions. 

- if(GetSelectedCount(pane 1) => 1. How do I find out what the name for "pane 1" is? is it the title?

- Do I have to put the hole code into the panes?

 

y_grynechko
Creator III
Creator III

Code goes into the measure in visual, not the pane. 

Name of the pane is the name of the dimension you use in it. 

george55
Partner - Creator III
Partner - Creator III
Author

Believe there is a misunderstanding. Date pane 1 and pane 2 using the same dimension but having a different calculation setup (see below %FIELDX). Consider: Weekend are not the only difference in the calculation setup between pane 1 and pane 2. If I put the code into the measure , the code does not know which caluculation setup to use (because there are using the same dimension).

2020.0130-090620.jpg

 

 

TimvB
Creator II
Creator II

I believe it is not possible to let two filter panes make different selections based on one %field. At least, Qlik Sense is not designed to do so.

In the script you could make two different flag fields based on the %field (and other fields). Then you can use these two newly generated fields in the front end. This also increases the performance of the UI, as less calculations are needed in the front end.

george55
Partner - Creator III
Partner - Creator III
Author

Thanks for your reply. The idea about the two different flags I had already (see my first post here). 

And I found a workaround to do it. Need to combine multiple actions in one click. Need only to know how to implement in a button. This is my last problem. Maybe you can help? See my newest post:

Thanks.

https://community.qlik.com/t5/New-to-Qlik-Sense/Button-Using-as-a-filter-pane/m-p/1670776#M156796