calculating percentage change

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

calculating percentage change

Mike Ealy
I need some help calculating percentage change using Lassoscript (v6)

TestScoreA = 29
TestScoreB = 38
Answer = 31%

Formula:
(TestScoreB - TestScoreA) / TestScoreA * 100 = percentage change


Non-Working Lasso code:
[var:'PercentChng'=((decimal:($TestScoreB))-(decimal:($TestScoreA))/(decimal
:($TestScoreA))*100)]


Working Lasso code:
[var:('PercentChng_1')=(Math_Sub:(decimal:($TestScoreB)),(decimal:($TestScor
eA)))]
[var:('PercentChng_2')=(Math_Div:(decimal:($PercentChng_step_1)),(decimal:($
TestScoreA )))]
[var:('PercentChng_3')=(Math_Mult:(decimal:($PercentChng_step_2)),100)]


I also need to format the answer. I'm assuming I can use something like
[$PercentChng->(setformat:-precision=1)]. Right?


Thanks,
Mike Ealy


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: calculating percentage change

Bil Corry
> I need some help calculating percentage change

Your non-working Lasso code uses a different formula than the one you provided.  You are, in effect, doing this:

TestScoreB - (TestScoreA / TestScoreA * 100) = percentage change


Corrected, it works:

var:'TestScoreA' = 29;
var:'TestScoreB' = 38;

var:'PercentChng'= ((decimal:$TestScoreB) - (decimal:$TestScoreA)) / (decimal:$TestScoreA) * 100;
$PercentChng->(setformat: -precision=0);
'Answer = ' + $PercentChng + '%'; // should be 31%


- Bil

------

Bil Corry
[hidden email]

Enterprise internet application development and security consulting
  http://www.fivegeeks.com/

Tools for Rapid Lasso Development
  http://www.lassoware.com/
 
-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Mike Ealy
Sent: Thursday, September 22, 2005 11:38 AM
To: [hidden email]
Subject: calculating percentage change

I need some help calculating percentage change using Lassoscript (v6)

TestScoreA = 29
TestScoreB = 38
Answer = 31%

Formula:
(TestScoreB - TestScoreA) / TestScoreA * 100 = percentage change


Non-Working Lasso code:
[var:'PercentChng'=((decimal:($TestScoreB))-(decimal:($TestScoreA))/(decimal
:($TestScoreA))*100)]


Working Lasso code:
[var:('PercentChng_1')=(Math_Sub:(decimal:($TestScoreB)),(decimal:($TestScor
eA)))]
[var:('PercentChng_2')=(Math_Div:(decimal:($PercentChng_step_1)),(decimal:($
TestScoreA )))]
[var:('PercentChng_3')=(Math_Mult:(decimal:($PercentChng_step_2)),100)]


I also need to format the answer. I'm assuming I can use something like
[$PercentChng->(setformat:-precision=1)]. Right?


Thanks,
Mike Ealy


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage



--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: calculating percentage change

Adam Randall
In reply to this post by Mike Ealy
This works for me:

[
   var: 'TestScoreA' = 29;
   var: 'TestScoreB' = 38;

   var: 'Answer' = ((decimal($TestScoreB) - decimal($TestScoreA)) /  
decimal($TestScoreA) * 100.0);
   $Answer->setformat(-precision = 1);
   $Answer;
]

Adam.


--
Adam Randall <[hidden email]>
Quality Assurance / Support
OmniPilot Software, Inc.
http://www.omnipilot.com/
(954) 874-3100
AIM/iChat: adamomni


On Sep 22, 2005, at 2:38 PM, Mike Ealy wrote:

> I need some help calculating percentage change using Lassoscript (v6)
>
> TestScoreA = 29
> TestScoreB = 38
> Answer = 31%
>
> Formula:
> (TestScoreB - TestScoreA) / TestScoreA * 100 = percentage change
>
>
> Non-Working Lasso code:
> [var:'PercentChng'=((decimal:($TestScoreB))-(decimal:($TestScoreA))/
> (decimal
> :($TestScoreA))*100)]
>
>
> Working Lasso code:
> [var:('PercentChng_1')=(Math_Sub:(decimal:($TestScoreB)),(decimal:
> ($TestScor
> eA)))]
> [var:('PercentChng_2')=(Math_Div:(decimal:($PercentChng_step_1)),
> (decimal:($
> TestScoreA )))]
> [var:('PercentChng_3')=(Math_Mult:(decimal:($PercentChng_step_2)),
> 100)]
>
>
> I also need to format the answer. I'm assuming I can use something  
> like
> [$PercentChng->(setformat:-precision=1)]. Right?
>
>
> Thanks,
> Mike Ealy
>
>
> --
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage
>


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: calculating percentage change

Rick Dieringer
In reply to this post by Mike Ealy

On Sep 22, 2005, at 2:38 PM, Mike Ealy wrote:

> I need some help calculating percentage change using Lassoscript (v6)
>
> TestScoreA = 29
> TestScoreB = 38
> Answer = 31%
>
> Formula:
> (TestScoreB - TestScoreA) / TestScoreA * 100 = percentage change
>
>
> Non-Working Lasso code:
> [var:'PercentChng'=((decimal:($TestScoreB))-(decimal:($TestScoreA))/
> (decimal
> :($TestScoreA))*100)]
>
>
> Working Lasso code:
> [var:('PercentChng_1')=(Math_Sub:(decimal:($TestScoreB)),(decimal:
> ($TestScor
> eA)))]
> [var:('PercentChng_2')=(Math_Div:(decimal:
> ($PercentChng_step_1)),(decimal:($
> TestScoreA )))]
> [var:('PercentChng_3')=(Math_Mult:(decimal:($PercentChng_step_2)),100)]

Why not do:

[var: 'PercentChng'=(math_mult: (math_div:  
(Math_Sub:(decimal:$TestScoreB),(decimal:$TestScoreA)),  
(decimal:$TestScoreA )),100)]


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: calculating percentage change

Pat Gilmour
In reply to this post by Mike Ealy
Hi Adam and Bil,

I see you're using different '-precision' settings (0 and 1). I don't  
see '-precision' in the manual. Can you explain what this does?

Thanks,

Pat


On 22 Sep 2005, at 20:15, Adam Randall wrote:

> This works for me:
>
> [
>   var: 'TestScoreA' = 29;
>   var: 'TestScoreB' = 38;
>
>   var: 'Answer' = ((decimal($TestScoreB) - decimal($TestScoreA)) /  
> decimal($TestScoreA) * 100.0);
>   $Answer->setformat(-precision = 1);
>   $Answer;
> ]
>
> Adam.
>
>
> --
> Adam Randall <[hidden email]>
> Quality Assurance / Support
> OmniPilot Software, Inc.
> http://www.omnipilot.com/
> (954) 874-3100
> AIM/iChat: adamomni
>
>
> On Sep 22, 2005, at 2:38 PM, Mike Ealy wrote:
>
>
>> I need some help calculating percentage change using Lassoscript (v6)
>>
>> TestScoreA = 29
>> TestScoreB = 38
>> Answer = 31%
>>
>> Formula:
>> (TestScoreB - TestScoreA) / TestScoreA * 100 = percentage change
>>
>>
>> Non-Working Lasso code:
>> [var:'PercentChng'=((decimal:($TestScoreB))-(decimal:
>> ($TestScoreA))/(decimal
>> :($TestScoreA))*100)]
>>
>>
>> Working Lasso code:
>> [var:('PercentChng_1')=(Math_Sub:(decimal:($TestScoreB)),(decimal:
>> ($TestScor
>> eA)))]
>> [var:('PercentChng_2')=(Math_Div:(decimal:($PercentChng_step_1)),
>> (decimal:($
>> TestScoreA )))]
>> [var:('PercentChng_3')=(Math_Mult:(decimal:($PercentChng_step_2)),
>> 100)]
>>
>>
>> I also need to format the answer. I'm assuming I can use something  
>> like
>> [$PercentChng->(setformat:-precision=1)]. Right?
>>
>>
>> Thanks,
>> Mike Ealy
>>
>>
>> --
>> ------------------------------
>> Lasso Support: http://support.omnipilot.com/
>> Search the list archives: http://www.listsearch.com/lassotalk.lasso
>> Manage your list subscription:
>> http://www.listsearch.com/lassotalk.lasso?manage
>>
>>
>
>
> --
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription: http://www.listsearch.com/ 
> lassotalk.lasso?manage
>
>
>


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: calculating percentage change

Adam Randall
In reply to this post by Mike Ealy
-Precision is part of the Decimal->SetFormat tag. You can find the  
documentation for it here:

<http://reference.omnipilot.com/LDMLReference.0.LassoApp?tag=718>

Regards,

Adam.

--
Adam Randall <[hidden email]>
Quality Assurance / Support
OmniPilot Software, Inc.
http://www.omnipilot.com/
(954) 874-3100
AIM/iChat: adamomni


On Sep 23, 2005, at 4:54 AM, Pat Gilmour wrote:

> Hi Adam and Bil,
>
> I see you're using different '-precision' settings (0 and 1). I  
> don't see '-precision' in the manual. Can you explain what this does?
>
> Thanks,
>
> Pat
>
>
> On 22 Sep 2005, at 20:15, Adam Randall wrote:
>
>
>> This works for me:
>>
>> [
>>   var: 'TestScoreA' = 29;
>>   var: 'TestScoreB' = 38;
>>
>>   var: 'Answer' = ((decimal($TestScoreB) - decimal($TestScoreA)) /  
>> decimal($TestScoreA) * 100.0);
>>   $Answer->setformat(-precision = 1);
>>   $Answer;
>> ]
>>
>> Adam.
>>
>>
>> --
>> Adam Randall <[hidden email]>
>> Quality Assurance / Support
>> OmniPilot Software, Inc.
>> http://www.omnipilot.com/
>> (954) 874-3100
>> AIM/iChat: adamomni
>>
>>
>> On Sep 22, 2005, at 2:38 PM, Mike Ealy wrote:
>>
>>
>>
>>> I need some help calculating percentage change using Lassoscript  
>>> (v6)
>>>
>>> TestScoreA = 29
>>> TestScoreB = 38
>>> Answer = 31%
>>>
>>> Formula:
>>> (TestScoreB - TestScoreA) / TestScoreA * 100 = percentage change
>>>
>>>
>>> Non-Working Lasso code:
>>> [var:'PercentChng'=((decimal:($TestScoreB))-(decimal:
>>> ($TestScoreA))/(decimal
>>> :($TestScoreA))*100)]
>>>
>>>
>>> Working Lasso code:
>>> [var:('PercentChng_1')=(Math_Sub:(decimal:($TestScoreB)),(decimal:
>>> ($TestScor
>>> eA)))]
>>> [var:('PercentChng_2')=(Math_Div:(decimal:($PercentChng_step_1)),
>>> (decimal:($
>>> TestScoreA )))]
>>> [var:('PercentChng_3')=(Math_Mult:(decimal:($PercentChng_step_2)),
>>> 100)]
>>>
>>>
>>> I also need to format the answer. I'm assuming I can use  
>>> something like
>>> [$PercentChng->(setformat:-precision=1)]. Right?
>>>
>>>
>>> Thanks,
>>> Mike Ealy
>>>
>>>
>>> --
>>> ------------------------------
>>> Lasso Support: http://support.omnipilot.com/
>>> Search the list archives: http://www.listsearch.com/lassotalk.lasso
>>> Manage your list subscription:
>>> http://www.listsearch.com/lassotalk.lasso?manage
>>>
>>>
>>>
>>
>>
>> --
>> ------------------------------
>> Lasso Support: http://support.omnipilot.com/
>> Search the list archives: http://www.listsearch.com/lassotalk.lasso
>> Manage your list subscription: http://www.listsearch.com/ 
>> lassotalk.lasso?manage
>>
>>
>>
>>
>
>
> --
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription: http://www.listsearch.com/ 
> lassotalk.lasso?manage
>


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage