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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
souadouert
Specialist
Specialist

VARIABLE WITH DYNAMIC NAME

Hello i have this table

  

ID_SALERPRODUCTCATEGORIEsalesCLIENT_PRODUCT
100P1c150010
100P2c1250010
102P1c350212
102P2c450313

and i have variables $(P1) ET $( P2)

P1=sum({<CATEGORIE={'C1'},sales={'<700'}>}1)

P2=sum({<CATEGORIE={'C5'},sales={'<700 >200'}>}1)

SO I need to create simple table , in dimension ID_saler and Product

and in expression i need to add the variable with corresponding to value dimensions --> =$(PRODUCT)

 

ID_SALERPRODUCTEXPRESSION
100P1$(PRODUCT)$(P1)
100P2$(PRODUCT)$(P2)
102P1$(PRODUCT)$(P1)
102P2$(PRODUCT)$(P2)

but iwhen i excuted , the expression shows the text expression

sum({<CATEGORIE={'C1'},sales={'<700'}>}1)

sum({<CATEGORIE={'C5'},sales={'<700 >200'}>}1)

So i need to force the interpretation

Capture.PNG

Labels (1)
1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

The problem is that $ sign expansions are on a chart level and do not work with row by row dimension values. You probably need to use a pick match construction like =Pick(Match(Product,'P1','P2'),$(P1),$(P2)). To make this variable have a look at (and the links in there)

Re: Using Pick and Match for multiple calculations

View solution in original post

6 Replies
YoussefBelloum
Champion
Champion

Hi,

what is the content of the variable $(PRODUCT) ?

you are using two variables in your expression ?

souadouert
Specialist
Specialist
Author

Hello,

the idea is that the dynamic variable name according to the value of the dimension product

Capture.PNG

and P1 and P2

P1=sum({<CATEGORIE={'C1'},sales={'<700'}>}1)

P2=sum({<CATEGORIE={'C5'},sales={'<700 >200'}>}1)

YoussefBelloum
Champion
Champion

a simple IF won't do the trick ?

if(PRODUCT='P1', $(P1), $(P2))

souadouert
Specialist
Specialist
Author

youssef I do not have the list of products,I must have as much product as dynamically variable

YoussefBelloum
Champion
Champion

stigchel
Partner - Master
Partner - Master

The problem is that $ sign expansions are on a chart level and do not work with row by row dimension values. You probably need to use a pick match construction like =Pick(Match(Product,'P1','P2'),$(P1),$(P2)). To make this variable have a look at (and the links in there)

Re: Using Pick and Match for multiple calculations