Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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
MVP
MVP

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
MVP
MVP

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