Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Operations with variables

Hello everyone

The problem is this: mathematical operations between variables do not work well !

This works well:

=$(v_Saldo) / $(v_Saldo_ap_1_mobile)

This does not return anything:

=($(v_Saldo) / $(v_Saldo_ap_1_mobile))-1

It is a "bug" in the program?

Thanks, Adriano

5 Replies
Not applicable
Author

Hi

I test both expression and both work well for me.

Anders

Not applicable
Author

Hi

I also tested both, and both work for me, so I would assume it's something to do with your variable definitions.

Can you tell us how the variables are defined, what do they contain?

Not applicable
Author

Hi, and thanks for your reply !

The variables are complex. Here is their definition:

v_Saldo --> If([Flag saldo iniziale]='SI',Sum([Partitario - Importo Con Segno]),Sum(If([Partitario - Flag Saldo apertura]='NO',[Partitario - Importo Con Segno])))

v_Saldo_ap_1_mobile -->

If

(

([Flag saldo iniziale]='SI',Sum({$<[Partitario - Anno Data Operazione] = {$(#=Only([Partitario - Anno Data Operazione])-1)} >} [Partitario - Importo Con Segno])





Adriano

The variables are complex

Not applicable
Author

Hi

You might try changing the location of your SUM function in the variable definition to the outside of the formula, this might help, so your variables wiil look like:

=SUM(If([Flag saldo iniziale]='SI',[Partitario - Importo Con Segno],If([Partitario - Flag Saldo apertura]='NO',[Partitario - Importo Con Segno])))


and

=SUM(If(([Flag saldo iniziale]='SI',{$<[Partitario - Anno Data Operazione] = {$(#=Only([Partitario - Anno Data Operazione])-1)} >} [Partitario - Importo Con Segno]) )


Second, if this doesn't work then you could calculate the value of variable 1 in one column, then variable 2 in a second column and then create a third column which has a formula such as:

=Column(1) - Column(2) - 1


Not applicable
Author

Hi

I tried to work on another PC.
In this case everything works well and I have no problems.
It is therefore a bad installation on this PC

Thank you very much for your help and directions to Formula

Adriano