Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sagar_vij99
Creator
Creator

Ignoring use of = used in variables while writing expression

Hi All,

Recently i gave an interview where i was being asked 2 question for which i am looking answer.

Q1. Variable is defined as '=sum(Sales)'. Now how should i write an expression so that this variable gets calculated after expanding. If i will simple use variable name say $(x), it will show total but i don't want that and it should be handled in chart expression only.

Q2. There is a master table of employees having 3 columns - ID, Name, Designation loaded with latest data. Now from here we need to store the data as client keeps latest data only. The question is, how we should create our qvds so that i can get designation of any employee on any date. Moreover the analysis will be around how promotions given.

If anybody can provide suggestions, it will be great. Thought of sharing some interview questions.

 

Regards

Sagar

Labels (2)
1 Reply
tresesco
MVP
MVP

Q1:

It is difficult to know what exactly your interviewer meant or wanted. If I take that you understood it correct and asking it right here - then for me,(assuming the definition itself doesn't have quotes) I don't see a way to refer the variable definition in the expression, because, since it has '=' before the definition, it is already expanded before you could refer it. So it would always give you same value across a chart rows and disregard the dimension values. (I would be happy to be proven wrong).

Ideally, if you need the result to respect dimension values, you don't put '=' before definition. Otherwise, there could have been other ways (not very intuitive, but works) you could have made it work to respect dimension values and not get a total with some definitions like:

tresesco_1-1622011543488.png

You could use double expansion, like : $(=$(vSum)) to get the desired output.

Or if you define it like:

tresesco_2-1622011718636.png

Then simple dollar expansion $(vSum) works well.