Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Pedro_Rodriguez
Contributor III
Contributor III

Expression in variable not the same formula

Hi all,

I have some data like:

1.PNG

My problem is that if I introduce my expresion directly in the table, it works well, but if I introduce the expression in a variable and use it as a measure in the table the result is not the same, it shows as total:

2.PNG

  Test2=sum(territ)

 

 

 

 

 

Labels (1)
1 Solution

Accepted Solutions
Or
Master II
Master II

If you use =$(Variable) on a variable containing an equal sign such as =sum(territ), it will be evaluated first, outside the context of the object / row, and the result will be used in your formula.

You could try replacing your variable with Sum(territ) instead of =Sum(territ) and then =$(Test2) should evaluate within the context of the row. In the example here, I've got =Sum(id) as Test1 and Sum(id) as Test2

Or_0-1618238634539.png

 

 

View solution in original post

1 Reply
Or
Master II
Master II

If you use =$(Variable) on a variable containing an equal sign such as =sum(territ), it will be evaluated first, outside the context of the object / row, and the result will be used in your formula.

You could try replacing your variable with Sum(territ) instead of =Sum(territ) and then =$(Test2) should evaluate within the context of the row. In the example here, I've got =Sum(id) as Test1 and Sum(id) as Test2

Or_0-1618238634539.png

 

 

View solution in original post