Negative numbers are useful - until theyβre not. It is quite a weird explanation, true, nevertheless sometimes negative sign can mess with your calculations, labels, visuals, and even logic.
You might simply just need a non-negative value of a number, that's all.
There comes PowerFX Abs()
function, so You can think of it like hitting no negativity button for numbers.
Abs()
actually is?The Absolute Value of a number is its distance from 0 on a number axis, regardless of its sign.
//Definiton
Abs(-10) β 10
Abs(5) β 5
//Local Variables
UpdateContext({loc_Number_Negative: -50});
Abs(loc_Number_Negative) β 50
UpdateContext({loc_Number_Abs: Abs(-50)});
loc_Number_Abs β 50
//Global Variables
Set(gl_Number_Negative, -100);
Abs(gl_Number_Negative) β 100
Set(gl_Number_Abs, Abs(-100));
gl_Number_Abs β 100
//Named Formula
nf_Number_Negative = -250;
//Temporary Variable with Named Formula displaying value in label as String Interpolation
With(
{
_v_Example_Abs: Abs(nf_Number_Negative)
},
$"Absolute Value: {_v_Example_Abs}"
)
Outcome β Absolute Value: 250
Variables, Named formulas are working just fine with Abs()
- how about tables?Abs()
Function can work on the whole table, if it is so called simple table.
As example I've created local variable storing a simple table definition.
To get Absolute values for all inputs in default columns called Value, We can simply put table name - in this scenario local variable - in Abs()
function.
//Local Variable
UpdateContext(
{
loc_Table_Simple:
[
-123,
-120,
-59,
-83,
-12,
-68,
0,
12,
48,
83,
818
]
}
);
Abs(loc_Table_Simple)
Outcome β Absolute Value for whole simple table is simple table, with no negatives:
[123,120,59,83,12,68,0,12,48,83,818]
You are calculating transactions refunds from returned products.
As money goes away from your account, it might be shown as negative value.
Summary of bank transfers, assumed as negative values "reducing a profit", should be visible as a negative?
You can decide which one you and your stakeholders would like to see in their app
β
Score Normalisation:
π Keep leaderboard values consistent by ignoring negativity
β
Distance or Delta Calculations:
π When comparing two values like size difference, Abs()
makes sure you're working with the raw difference.
β
Visual Threshold Logic:
π Progress bar reacts if something is βoffβ by more than 10 units, no matter the direction.
β
Style Conditional Formatting:
π Change colors based on how far something is from the target, not whether it's over or under.
β Validate and clean up user input
β Ease up some math
β Remove negative results from formulas
β
Display data for charts where negatives distort visualization
β Using Abs() blindly in financial Apps
π Donβt use Abs()
where positive/negative sign matters (like in profit/loss reports). You might hide crucial data.
β Misunderstanding its simplicity
π It only removes the sign. It doesnβt round, fix, or evaluate formulas beyond one value.
β Misunderstanding the Error Handling
π There is no Error Handling included in Abs()
β Wonβt work on text:
π Valid input are numbers only. If number is provided as text - wrap in Value()
first
β Not a validation tool:
π it just transforms numbers for its distance from point (0,0), therefore doesnβt check if provided value is a number
Abs()
π Abs()
makes every number positive β itβs that simple.
π Use it for clean comparisons, UI triggers, normalizations, and data cleaning.
π Always check if your app logic needs to preserve positive/negative meaning β donβt mask real issues.
π Pair it with Coalesce()
, Round()
, or If()
for next-level logic flows.
π Watch the Reels π₯ : TikTok | Instagram | YouTube Shorts
π Swipe the Carousel: LinkedIn | Instagram
FYI: URLs will be activated soon π
Follow as we break down PowerFX - function by function - in the most visual, practical way on the internet.