Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
prakhar_21
Contributor
Contributor

Can anyone help me in converting the below expression in pick and match

Hi All, I need help in converting the below expression into pick and match. Also if multiple month's are selected the output should be '-'.  

if(GetSelectedCount(MONTH)=1 and GetSelectedCount(QUARTER)=0 and GetSelectedCount(FY)=0 and getselectedcount(DATE)=0, ((count({<VAL_CDE*={"*abc"}>}VAL_CDE)/ count({1<MONTH={'$(prev_month)'},VAL_CDE*={"*abc"}>}VAL_CDE))-1)*100,

if(GetSelectedCount(MONTH)=0 and GetSelectedCount(QUARTER)=1 and GetSelectedCount(FY)=0 and getselectedcount(DATE)=0, ((count({<VAL_CDE*={"*abc}>}VAL_CDE)/ count({1<QUARTER={'$(quarter_name)'},VAL_CDE*={"*abc"}>}VAL_CDE))-1)*100,

if(GetSelectedCount(MONTH)=0 and GetSelectedCount(QUARTER)=0 and GetSelectedCount(FY)=0 and getselectedcount(DATE)>=1, ((count({<DATE= {">=$(=date(min(DATE)))<=$(=date(max(DATE)+1))"},VAL_CDE*={"*abc"}>}VAL_CDE)/ count({1<DATE= {">=$(=date(min(DATE)-(max(DATE)-min(DATE))-1))<=$(=date(max(DATE)-(max(DATE)-min(DATE))))"},VAL_CDE*={"*abc"}>}VAL_CDE))-1)*100,

if(GetSelectedCount(MONTH)=0 and GetSelectedCount(QUARTER)=0 and GetSelectedCount(FY)=1 and getselectedcount(DATE)=0, ((Count({<MONTH= {">=$(=Yearstart(max(MONTH),0,4))<=$(=Yearend(max(MONTH),0,4))"},VAL_CDE*={"*abc"}>}VAL_CDE)/ Count({1<MONTH={">=$(=Yearstart(max(MONTH),-1,4))<=$(=Yearend(max(MONTH),-1,4))"},VAL_CDE*={"*abc"}>}VAL_CDE))-1)*100))))

 

This is an urgent requirement please help. 

3 Replies
udit_k
Partner - Creator II
Partner - Creator II

create the key for all conditions and using single pick match condition to evaluate multiple expression

 

Example:-

 

Load *,

USER&'-'&Region&'-'&Country as Key;
LOAD * INLINE [

USER, Region, Country

1,USA, ABC,

2, USA, XYZ,

3, AUS, PQR

4, IND, FGH

5, USA, ERT

1,RSA, TYU

1, SL, FGG

1, BAN, ERT

];

pick(wildmatch(Key,'1-USA-ABC','2-USA-XYZ','3-AUS-PQR','4-IND-FGH','5-USA-ERT'),

sum(1),
sum(2),
sum(3),
sum(4),
Sum(5)
)

 

udit_k_0-1688377368500.png

 

prakhar_21
Contributor
Contributor
Author

Actually this expression needs to be added in KPI in chevrons and according to filter selection this should work. I tried Pick and match but with one FY selection and multiple MONTH selection it's giving the output of FY selected ideally it should show '-'

udit_k
Partner - Creator II
Partner - Creator II

ok, try like this 

pick(wildmatch(GetSelectedCount(Country)&'-'&GetSelectedCount(Region)&'-'&GetSelectedCount(USER),'1-0-0','2-1-0','1-0-0','0-0-0','1-0-1'),

sum(1),
sum(2),
sum(3),
sum(4),
Sum(5)
)

For Selection 2-1-0 (2 country,1 Region, 0 User)

udit_k_1-1688381345142.png

 

 if no criteria matches it displays '-' null .

 

udit_k_0-1688381261970.png