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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mk95
Partner - Contributor II
Partner - Contributor II

Use an expression value in Set Expression

Hello everybody, i want to use the value of an expression in a set expression.

For e.g. my expression ist --> 

if((only({<Jahr={"$(=max(Jahr))"}>}[AuslaufFlag])=1 and only({<Jahr={"$(=max(Jahr)-1)"}>}[AuslaufFlag])=0) or (only({<Jahr={"$(=max(Jahr))"}>}[AuslaufFlag])=1 and len(only({<Jahr={"$(=max(Jahr)-1)"}>}[AuslaufFlag]))=0),'Zugang',Null())

and now want to use the value "Zugang" for a set expression

like sum({$<Zugang={'Zugang'}>}[Bilanzwert zu EK]) 

 

But i get wrong values, can someone help me :)? 

2 Replies
edwin
Master II
Master II

i suggest try the following:
1. clear all filters (create a current selection object to make sure nothing is selected)
2. create a list for the field Zugang, then select the value 'Zugang'
3. create a text box with the expression sum([Bilanzwert zu EK])

the text object should have the same value as 
sum({$<Zugang={'Zugang'}>}[Bilanzwert zu EK]) 

then re-create the scenario where you arent getting the expected value.  check the selections (what filters you have) and go from there - you can try clear filters one by one

otherwise, attach a qvw

marcus_sommer

I assume it would be rather not possible because you would need to embed it within a $-sign expansion which operate only on a global level. Another possibility might be to use this within any aggr() constructs but I think it makes everything more complicated as it would be helpful. Therefore I suggest a small change to your approach and using it as a flag-calculation (maybe within a variable) like:

var:
if((only({<Jahr={"$(=max(Jahr))"}>}[AuslaufFlag])=1 and only({<Jahr={"$(=max(Jahr)-1)"}>}[AuslaufFlag])=0) or (only({<Jahr={"$(=max(Jahr))"}>}[AuslaufFlag])=1 and len(only({<Jahr={"$(=max(Jahr)-1)"}>}[AuslaufFlag]))=0),1,0)

and then as expression

sum([Bilanzwert zu EK]) * $(var)

- Marcus