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: 
roberto99
Contributor III
Contributor III

Set analysis variable = getfieldselection

Hello, I have the following doubt.

I have the following dimensions: Shops, Cod_Art, and the stock of each item per store.

I also have 2 variables, vOrigin and vDestiny (With them I intend to compare the existing stock in vOrigen and that there is not in vDestiny).

I have tried with similar to this but it doesn't work

sum({<$(vOrigen)={'$(=getfieldselections(Cod_Tienda))'}, $(vDestiny)={'$(=getfieldselections(Cod_Tienda))'} >}Stock)

Thanks for the help

Labels (1)
2 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hello,

Take below as an example.

GetFieldSelections(Year) will give you below output if you select two years.

AshutoshBhumkar_0-1638776668760.png

Which will not be the proper syntax of Set Analysis.

 

You might want to use below set in your expression which will give result in quotation marks..

=Replace(GetFieldSelections(Year),',','","')

AshutoshBhumkar_1-1638776866471.png

Try this expression.

sum({<$(vOrigen)={"$(=Replace(GetFieldSelections(Cod_Tienda),',','","'))"}, $(vDestiny)={"$(=Replace(GetFieldSelections(Cod_Tienda),',','","'))"} >}Stock)

 

Hope this helps.

Thanks,
Ashutosh

 

roberto99
Contributor III
Contributor III
Author

Thanks for the answer, but it gives me syntax error, if I change the variable to "Cod_Tienda" the error disappears.

Is there any other way?

thanks