Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
mahitham
Creator II
Creator II

Dynamic Variable help

  Hi Experts,

  In the below logic can any one please help me to pass the Dynamic Variables on 2019,2018 and 2017.

  if(Match(Priority,'2019  Plan','2018 Plan','2017  Plan'),Priority)  as  Priority

Thanks in advance.

7 Replies
tresesco
MVP
MVP

Try like:

  if(Match(Priority,$(vYear)&  ' Plan', $(vYear)&' Plan', $(vYear)&'  Plan'),Priority)  as  Priority

mahitham
Creator II
Creator II
Author

Hi @tresesco 

Thanks for your reply.

I am looking for backend solution

I have a Year field with 2019,2017 and 2016. 

Can you please help me to derive the dynamic variables from this Year field to pass on if logic.

Load

ID,

Year,

  if(Match(Priority,'2019 Plan', '2018 Plan', '2017  Plan'),Priority)  as  Priority

From [lib://test/Plan.qvd];

 

Thanks in advance

tresesco
MVP
MVP

Could you please explain the logic in words?

mahitham
Creator II
Creator II
Author

Hi @tresesco 

From Priority Field Max of Year,Second Max of Year and Third Max of Year Plans need to filter dynamically .

Priority field contains the below records

Priority

2019 Plan

2018 Plan

2017 Plan

TBC Plan

tresesco
MVP
MVP

Do you want to filter only this field or the entire data set based on the logic?

mahitham
Creator II
Creator II
Author

Only this field

tresesco
MVP
MVP

Try like:

Input:
Load
	Priority,
	Left(Priority,4) as Year
Where IsNum(Left(Priority,4));
Load * Inline [	
Priority
2019 Plan
2015 Plan
2018 Plan
2011 Plan
2017 Plan
2010
2009
TBC Plan
];

Tmp:
Load 
	Year 
Resident Input Order By Year;

Let vMax3=Peek('Year',-3);

Output:
Load If(Year>=$(vMax3),Priority) as Priority Resident Input;

Drop Table Input, Tmp;