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

Creating truncated reference lines

Hi All,

I have created truncated reference lines for several items that I have plotted on a time series chart. Plotting each item separately (e.g. Fig 1  below) works OK but when I try to select all items the truncated reference line does not look right.

I have attached an example QlikView file and data file.

Appreciate any help you can provide.

Fig. 1

cgaleaQlik_1-1609887978324.png

 

Fig. 2

cgaleaQlik_2-1609888026895.png

Thank you,

Charles

 

2 Replies
mfchmielowski
Creator II
Creator II

Hi Charles.

I've modified yours expression to:

if(wildmatch(GetFieldSelections(Item), 'A*') and Date < '01 Jul 2020', 5,
if(wildmatch(GetFieldSelections(Item), '*B*') and Date < '01 Jul 2020', 3,
if(wildmatch(GetFieldSelections(Item), '*C*') and Date < '01 Jul 2020', 1,
if(wildmatch(GetFieldSelections(Item), '*D*') and Date < '01 Jul 2020', 2.5,
if((
	match(GetFieldSelections(Item,','), 'A,B,C,D') 
	or
	len(GetFieldSelections(Item)) < 1
) 
	and Date < '01 Jul 2020', 10, 0)))))

 

It's not perfect becease will work properly only when you select on Item listbox: one value, all values or leave it empty. Please read  GetFieldSelections() documentation before work with wider set of items. Calculated 'Reference lines' should use agregating function like sum(). 

I suggest you to add reference value to script data, Ref_Lines_Data.xlsx as a values to sum. Will be easier to create a valid expression.

cgaleaQlik
Contributor III
Contributor III
Author

Great, looks like it will help for now. Appreciate your help!!!