Datasummit
  • Home
  • About
  • Services
  • Contact
  • Blog
    • Reporting
    • MySql
    • Sage
    • Informix
    • ERP
    • General

Cool way to calculate inline MAX of two values in MS SQL

Business Analysis, BI and Reporting, Project Management

  • Home   /  Blog   /  MS SQL   /  
  • Cool way to calculate inline MAX of two values in MS SQL

Cool way to calculate inline MAX of two values in MS SQL

Aug 6,2016 Comments Off on Cool way to calculate inline MAX of two values in MS SQL Forecasting, Hannes Truter, MS SQL

— The following expression calculates ==> max(@val1, @val2)

SELECT 0.5 * ((@val1 + @val2) + ABS(@val1 – @val2))

 

Kudos to splattne.

 

(Used in Demand Forecasting calculation project)

Blog Categories

  • ERP
  • General
  • Informix
  • MS SQL
  • MySql
  • Reporting
  • Sage
  • Syspro
  • Uncategorized