Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to use getfieldselections in an expression, to get the user's selection of the company code.
Because I have multiple possibilities, I use a nested if. But it works for only for one nested if, when I add another 'if' I get a error in the expression. is there a restriction in use, because separate the syntax is working.
=if(GetFieldSelections([Company Code])= ' ',Sum({$<[Customer Code]=E({1<[NoFilter]={'Intercompany-4'}>})>}Quantity)
,if(GetFieldSelections([Company Code],'+',2)='BE04','US12',Sum({$<[Customer Code]=E({1<[Filter BE04/US12]={'Intercompany-4'}>})>}Quantity))
,if(GetFieldSelections([Company Code],'+',2)='BE04','US29',Sum({$<[Customer Code]=E({1<[Filter BE04/US29]={'Intercompany-4'}>})>}Quantity))
,if(GetFieldSelections([Company Code],'+',2)='US12','US29',Sum({$<[Customer Code]=E({1<[Filter US12/US29]={'Intercompany-4'}>})>}Quantity)))
or
=if(GetFieldSelections([Company Code],',',2)='BE04','US12',Sum({$<[Filter BE04/US12]=-{'Intercompany-4'}>}Quantity)
,if(GetFieldSelections([Company Code],',',2)='BE04','US29',Sum({$<[Filter BE04/US29]=-{'Intercompany-4'}>}Quantity))
With both I get an error, can anyone say what the problem is
Or is it better to use pick match ..; but how is the syntax to get the same result
Br
Super... Please close this thread by marking correct and helpful responses
Qlik Community Tip: Marking Replies as Correct or Helpful
Best,
Sunny
Try
if(wildmatch(GetFieldSelections([Company Code],',',2),'BE04','US12'),Sum({$<[Filter BE04/US12]=-{'Intercompany-4'}>}Quantity),
if(wildmatch(GetFieldSelections([Company Code],',',2),'BE04','US29'),Sum({$<[Filter BE04/US29]=-{'Intercompany-4'}>}Quantity))
Hi,
Thanks for the quick answer, but still an error in the expression
=if(WildMatch(GetFieldSelections([Company Code],',',2)='BE04','US12',Sum({$<[Filter BE04/US12]=-{'Intercompany-4'}>}Quantity))
,if(WildMatch(GetFieldSelections([Company Code],',',2)='BE04','US29',Sum({$<[Filter BE04/US29]=-{'Intercompany-4'}>}Quantity))))
Br
you should provide a sample qvf to show what you are looking for...
Try,
if(wildmatch(GetFieldSelections([Company Code]),'BE04','US12'),Sum({$<[Filter BE04/US12]=-{'Intercompany-4'}>}Quantity),
if(wildmatch(GetFieldSelections([Company Code],'BE04','US29'),Sum({$<[Filter BE04/US29]=-{'Intercompany-4'}>}Quantity))
Hi,
Same result error
@Andrea provide a qvf is difficult, sensitive data, I have to create a small qvf with sample data. But I get a syntax error in the expression so I'm not that far to get a result in my Pivot table
Br
If statement goes like this
If(Something = Something, True,
If(Something2 = Something2, True, False)
Now, I am not sure your if statement is doing that
=if(GetFieldSelections([Company Code],',',2)='BE04','US12',Sum({$<[Filter BE04/US12]=-{'Intercompany-4'}>}Quantity)
,if(GetFieldSelections([Company Code],',',2)='BE04','US29',Sum({$<[Filter BE04/US29]=-{'Intercompany-4'}>}Quantity))
Now what I am not sure is what is US12? Are you checking for 2 things BE04 and US12? If that is what you want, then may be this
=if(GetFieldSelections([Company Code],',',2)='BE04, US12', Sum({$<[Filter BE04/US12]=-{'Intercompany-4'}>}Quantity), if(GetFieldSelections([Company Code],',',2)='BE04, US29', Sum({$<[Filter BE04/US29]=-{'Intercompany-4'}>}Quantity))
Hi Sunny,
indeed I'm checking for BE04 and US12, so maybe I have to put it between ()
=if(GetFieldSelections([Company Code],'+',2)=('BE04',US12')...
And when I understand it, the last if, has to include a false statement, so could be " sum(Quantity) " if I have that requirement,
if(GetFieldSelections([Company Code]),('BE04','US12'),Sum({$<[Filter BE04/US12]=-{'Intercompany-4'}>}Quantity),
if(GetFieldSelections([Company Code],('BE04','US29'),Sum({$<[Filter BE04/US29]=-{'Intercompany-4'}>}Quantity, Sum(Quantity)))))
but it still gives an error
Br
Did you check this?
=If(GetFieldSelections([Company Code], ',', 2) = 'BE04, US12', Sum({$<[Filter BE04/US12]=-{'Intercompany-4'}>}Quantity), If(GetFieldSelections([Company Code], ',', 2) = 'BE04, US29', Sum({$<[Filter BE04/US29]=-{'Intercompany-4'}>}Quantity))
Also, the last if doesn't need to include a false statement.... you can actual leave it blank....