Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I am new with QlikView and have a problem using variables:
I have defined the following variables:
v1:
sum({$<[Type]={'Apples'}>} [Total value])+
sum({$<[Type]={'Oranges'}>} [Total value])
v2:
COUNT(DISTINCT {$<[Invoice]={'Main'}>}InvoiceMonth)
I have uploaded the 3 different invoices with the values of the Apples and Oranges
v1: Gives me the total cost of Apples and Oranges.
v2: Gives me the number of invoices I have loaded.
I need to get the average cost and then extrapolate it for the whole year. I have defined the valariables as I have diferent types of invoices and that have been uploaded in different periods.
When I include in a table the following expressoins:
Ex1 =$(v1) and I get the correct sum: 992.19
Ex2 =$(v2) and I get the correct number of invoices: 3
Then in a new expression I add:
=($(v1)/$(v2))*12
And the result is 5424.44 which is incorrect as (992.19/3)*12 = 3968.76
If I use the names of the expressions Ex1 and Ex2 it works fine, but I want to use the variables as the expressions are only there for testing!
Can someone help me with this?
Thanks a lot!
Hi
Try like this
v3 = $(v1)/$(v2)
Ex3 =$(v3)*12
Hope it helps
try with Column() function, like:
(Column(1)/Column(2))*12
Or, in your case
(Ex1/Ex2)*12
Hi
Try like this
v3 = $(v1)/$(v2)
Ex3 =$(v3)*12
Hope it helps
Thanks, This worked fine, but still can not understand why a new variable is needed!
Thanks again