Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have defined the below variables in the system:
vSales1
vSales2
vTickets1
vTickets2
vSales = $(vSales1) + $(vSales2)
vTickets = $(vTickets1) + $(vTickets2)
AverageSales = ($(vSales1) + $(vSales2)) / ($(vTickets1)+$(vTickets2))
bring rights results.
where as the below formula brings wrong results:
AverageSales = $(vSales) / $(vTickets)
any idea how to resolve this?
any NULL-values involved?
Peter
Hi,
Try to define the variables as below:
vSales = vSales1 + vSales2
vTickets = vTickets1 + vTickets2
(remove the '$')
You should get the correct result on AverageSales = $(vSales) / $(vTickets) .
i tried to rebuild your issue and for me it works fine.
see attached sample.
hope this helps
I guess you missed the "=" signs
hope this helps
I think you have a problem with order of operations. The divide is being done first. Adds parens to control the order.
vSales = ($(vSales1) + $(vSales2))
vTickets = ($(vTickets1) + $(vTickets2))
-Rob
To easily detect what ROb says is going wrong, try to perform the $-sign substitution yourself and see whether you get wrong precedence or skipped/missing operands in your calculations.
If I do the substitution manually, I get an almost-final expression of = $(vSales) / $(vTickets) into
= $(vSales1) + $(vSales2) / $(vTickets1) + $(vTickets2)
which means that only $(vSales2) (or a part of that variable) is divided by $(vTickets1) because of operator precedence.
Another time-saving suggestion: when using $-sign substitution to assemble expressions, always use too many parentheses. They don't cost you anything but will save you many hours of searching and debugging.
[Edit] Sorry, corrected first name spelling
no null values
Sorry I wrongly marked this as correct answer. This does not help.
$(vSales) and $(vTickets) give the right answer whereas $(vSales) / $(vTickets) bring wrong answer.