View Thread
 Print Thread
Function to calculate percentage increase of two values
admin
Return a decimal(18,2) percentage increase of two values



SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[udf_CalculatePercentageIncrease]
(
   @ValueOne DECIMAL(18,2),
   @ValueTwo DECIMAL(18,2)
)
RETURNS DECIMAL(18,2)
AS
BEGIN

   RETURN CONVERT(DECIMAL(18,2), ((@ValueTwo - @ValueOne) / @ValueOne)) * 100

END

GO

Jordon Pilling | Heavencore Administrator
 
Jump to Forum