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

If condition

I want below if condition in single if condition.

I am using below code for titles.

if(GetFieldSelections(Product)='SM' and GetFieldSelections(Territory)>0,'Sales(KL)', 'Sales(TKL)'

if(GetFieldSelections(Product)='DM' and GetFieldSelections(Territory)>0,'Sales(MT)', 'Sales(TMT)'
))

 

Thanks & Regards,

Sachin Yadav

Labels (2)
1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

Can you explain the logic? I can propose this two solution but I'm not sure.

//You can try
If(GetFieldSelections(Territory)>0,
  Pick(Match(GetFieldSelections(Product), 'SM', 'DM'), 'Sales(KL)', 'Sales(MT)'),
  Pick(Match(GetFieldSelections(Product), 'SM', 'DM'), 'Sales(TKL)', 'Sales(TMT)')
)

//Or
If(GetFieldSelections(Product)='SM',
  If(GetFieldSelections(Territory)>0,
    'Sales(KL)',
    'Sales(TKL)'
  ), 
  If(GetFieldSelections(Product)='DM' and GetFieldSelections(Territory)>0,
    'Sales(MT)', 
	'Sales(TMT)'
  )
)

 

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

3 Replies
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

Can you explain the logic? I can propose this two solution but I'm not sure.

//You can try
If(GetFieldSelections(Territory)>0,
  Pick(Match(GetFieldSelections(Product), 'SM', 'DM'), 'Sales(KL)', 'Sales(MT)'),
  Pick(Match(GetFieldSelections(Product), 'SM', 'DM'), 'Sales(TKL)', 'Sales(TMT)')
)

//Or
If(GetFieldSelections(Product)='SM',
  If(GetFieldSelections(Territory)>0,
    'Sales(KL)',
    'Sales(TKL)'
  ), 
  If(GetFieldSelections(Product)='DM' and GetFieldSelections(Territory)>0,
    'Sales(MT)', 
	'Sales(TMT)'
  )
)

 

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
sachin961
Contributor II
Contributor II
Author

I am using below code which is working fine till line number 3. Line number 4 Is not working.

I want default Sales Volume(TKT) in title so i am using line 1.

when i select any product and territory (Line 2 and line 3) then it should come Sales Volume(KL) or  Sales Volume(MT) according to selection of pickmatch.

Line 4 is not working. Sales Volume(TKL), Sales Volume(TMT) output is not getting in title and it should come when i select any product only



=If(GetSelectedCount(Product)=0,'Sales Volume(TKT)', // Line 1

If(GetFieldSelection(Territory)>0, //Line 2

Pick(Match(GetfieldSelections(Product),'PGP','DGP','NPG','CGP','AUTO LPP'),'Sales Volume(KL)','Sales 
Volume(KL)','Sales Volume(MT)','Sales Volume(MT)','Sales Volume(MT)', //line 3

Pick(Match(GetfieldSelections(Product),'PGP','DGP','NPG','CGP','AUTO LPP'),'Sales Volume(TKL)','Sales Volume(TKL)','Sales  Volume(TMT)','Sales Volume(TMT)','Sales Volume(TMT)'  //Line 4

))))

 

 

Thanks & Regards,

Sachin Yadav

sachin961
Contributor II
Contributor II
Author

Yes it is working by using below code. my code was not working because I was not using bracket in pick match.

Thanks Aurelien_Martinez.

 

If(GetFieldSelections(Territory)>0,
  Pick(Match(GetFieldSelections(Product), 'SM', 'DM'), 'Sales(KL)', 'Sales(MT)'),
  Pick(Match(GetFieldSelections(Product), 'SM', 'DM'), 'Sales(TKL)', 'Sales(TMT)')
)