The abs function returns the absolute value of the expression value. The "absolute value" of a number is its distance from zero as a positive number.
Examples
The abs function can be used to return positive numbers from negative numbers.
For instance, to return positive 4 from negative 4:
abs(-4)
Typically, the abs function is used with a field reference or an expression. For example, you might want to determine how much the price of an item changed, but don't want to know if it went up or down:
abs(${item.start_price}-${item.end_price})
Things to know
abs is useful for determining the difference between two values, regardless of which value is bigger. For instance, this returns 1:
abs(2 - 1)
This also returns 1:
abs(1 - 2)
As in the previous example, you could compare two fields this way:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[],[],null,["# abs\n\nThe `abs` function can be used in [custom filters](/looker/docs/2512/filtering-and-limiting#custom-filters) and [table calculations](/looker/docs/2512/table-calculations) to get the absolute value of an expression.\n\nSyntax\n------\n\n**`abs(value)`**\n\nThe `abs` function returns the absolute value of the expression `value`. The \"absolute value\" of a number is its distance from zero as a positive number.\n\nExamples\n--------\n\nThe `abs` function can be used to return positive numbers from negative numbers.\nFor instance, to return positive 4 from negative 4: \n\n abs(-4)\n\nTypically, the `abs` function is used with a field reference or an expression. For example, you might want to determine how much the price of an item changed, but don't want to know if it went up or down: \n\n abs(${item.start_price} - ${item.end_price})\n\nThings to know\n--------------\n\n`abs` is useful for determining the difference between two values, regardless of which value is bigger. For instance, this returns 1: \n\n abs(2 - 1)\n\nThis also returns 1: \n\n abs(1 - 2)\n\nAs in the previous example, you could compare two fields this way: \n\n abs(${item.start_price} - ${item.end_price})"]]