Daily DAX : Day 419 ABS

Power BI DAX - ABS() Function

ABS() is a simple but very useful mathematical function in DAX that returns the absolute (positive) value of a number.

Syntax

ABS(number)

Parameters

  • number – Any real number or a column/expression that returns a number

Return Value

A positive number (or zero). The sign of negative numbers is removed.

Examples

ExpressionResult
ABS(-10)10
ABS(15)15
ABS(-5.7)5.7
ABS(0)0

Common Use Cases in Power BI

  1. Calculate forecast error magnitude
    Absolute Error = ABS([Actual Sales] - [Forecasted Sales])
  2. Handle negative variances positively
    Budget Variance (Abs) = ABS([Budget] - [Actual])
  3. Distance or difference calculations
    When you only care about magnitude, not direction
  4. Avoid negative values in visuals
    Some visuals (like KPIs or cards) look confusing with negative numbers
  5. Ranking or sorting by size of deviation
    Rank by Error = RANKX(ALL(Products), ABS([Error]), , DESC)

Real-World Example (Measure)

MAE (Mean Absolute Error) = 
AVERAGEX(
    Sales,
    ABS([Actual Sales] - [Forecasted Sales])
)

Summary: Use ABS() whenever you need the positive magnitude of a number — especially useful in error metrics, variance analysis, and clean visual reporting.

Comments

Popular posts from this blog

Daily DAX : Day 131 SELECTEDMEASURE

Daily DAX : Day 446 INFO.CSDLMETADATA

Daily DAX : Day 453 ENDOFWEEK