Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Dynamic reference line based on filter

Is it possible to create a dynamic reference line based on what filter is selected?  I am displaying work hours by employee and there are options for calendar year, calendar month year (Jan-2018) and then calendar week.  If they select a year, I want the reference line to be 2080 hours for the calendar year, 160 for the calendar month year, and 40 for the calendar week.  Thanks.

1 Solution

Accepted Solutions
rittermd
Master
Master

You might need to reverse the order of your if statements so that you are checking for Week first and Year last.  That might work.

View solution in original post

5 Replies
rittermd
Master
Master

I am not sure that this would work.  But you could try using GetFieldSelections(filter) and depending on what value is returned set the value to the appropriate number value in your setup for the reference line. 

Hopefully that made sense.

rittermd
Master
Master

I just tested this in one of my apps and it works.

=If (GetFieldSelections(ownerid_Name) like 'Argolo*',1,.5)

You just need to modify this to check your filter field and the values (Year, Month, etc.) and the numeric value that you want the line to show and that should work.

Anonymous
Not applicable
Author

That worked thank you very much, but not totally the way I wanted, so I probably didn't explain myself fully.  If I select one of the three filters (Year, Month Year, or Week) the reference line shows up.  But if I first select the year, then a month and finally a week, the reference line stays at the year level.  I would want the line to change based on the last filter used.

Here is the expression that I used.

=If(GetFieldSelections([Labor Cal Year]) like '201*',2080,

     if(GetFieldSelections([Labor Month Year]) like '2017-*' or '2018-*',160,

         if(GetFieldSelections([Labor Cal Week]) like 'W*',40)))

rittermd
Master
Master

You might need to reverse the order of your if statements so that you are checking for Week first and Year last.  That might work.

Anonymous
Not applicable
Author

That did the trick.  Thank you very much.