Learn how to use Custom Dimension operators and functions in Polar Analytics to transform, categorize, and analyze your data with flexible rule-based logic.
What Are Custom Dimensions?
Custom Dimensions in Polar Analytics let you segment, label, and transform your data using rule-based logic. They are useful when you want to clean up raw values, group records into meaningful categories, extract parts of text, or build date-based and numeric breakdowns for reporting. The current feature set includes comparison operators, text functions, date functions, math functions, and regex-based pattern matching.
In this article, readers will learn:
How Custom Dimension logic works using When, Then, and Else
Which operators are available and when to use each one
How to format text, date, math, and regex functions correctly
Step-by-step examples for building practical Custom Dimensions in reports
Extended Custom Dimension tutorial
Core Concepts
How Custom Dimension Logic Works
Before using operators or functions, it helps to understand the structure of a Custom Dimension. Every rule is built from three parts:
When: the condition that must be true
Then: the value returned when the condition is met
Else: the fallback value returned when no conditions match
A single When block can contain multiple conditions. These conditions can be combined with:
Examples:
Build Your Logic (Step-by-Step)
Open the Custom Dimension builder.
Add a When condition using the dimension you want to evaluate.
Choose the operator that matches the type of comparison you need.
Enter the value or formula to test.
In Then, enter the output you want Polar to return when the condition is true.
In Else, add a fallback output so unmatched values still return something useful.
Save the Custom Dimension and add it to a report as a breakdown or grouping field.
Operators Reference
Use operators to compare a dimension against a condition:
Transforming Data
Functions let you return transformed values instead of raw dimension values. They are especially useful for cleaning labels, extracting parts of strings, formatting dates, and making simple calculations directly inside a Custom Dimension.
Text functions
Use text functions to shorten, standardize, combine, or extract text from fields like SKUs, titles, tags, or UTM values.
Create Text Transformations (Step-by-Step)
Add a new Custom Dimension rule.
In When, define the condition that identifies which rows should be transformed.
In Then, enter the function using the correct format.
Use the original dimension or a fallback label in Else.
Save the Custom Dimension and test it in a report.
Example workflow:
Use SKU contains "-" in When.
In Then, enter Left(SKU, '12') if you want the first 12 characters only.
In Else, return SKU so all other values stay unchanged.
Left - Returns the leftmost characters of a string.
Format: Left(value, length)
value: The dimension/text you want to shorten (e.g. a SKU, title, or URL).
length: The number of characters to keep from the start.
Example: Left(SKU, '4') → PREM-123456 → PREM
Right - Returns the rightmost characters of a string.
Format: Right(value, number)
value: The dimension/text you want to shorten (e.g. a SKU, title, or URL).
length: The number of characters to keep from the start.
Example: Right(SKU, '4') → PREM-1234 → 1234
Lower - Converts all text to lowercase.
Format: Lower(value)
Example: Lower(Country Code) → "RO" becomes "ro"
Upper - Converts all text to uppercase.
Format: Upper(value)
Example: Upper(Campaign Name) → "summer sale" becomes "SUMMER SALE"
Concat - Combines two dimensions or strings.
Format: Concat(value1, value2)
Example: Concat(Country Code, Zip Code) → "IL" + "90210" → "IL90210"
Trim - Removes leading and trailing whitespace.
Format: Trim(value)
Example: Trim(Product Title) → " Deluxe Watch " becomes "Deluxe Watch"
Replace - Replaces a dimension or string of text with a defined value or dimension
Format: Replace(subject, pattern, replacement)
subject: The dimension you want to target
pattern: The substring that you want to replace
replacement: The value used as a replacement
Example: Replace(Product Title, 'Trial', 'Standard') → "Trial Kit" becomes "Standard Kit"
Split Part - Splits a dimension or a string of text into parts using a delimiter and returns the selected part.
Format: Split_part(string, delimiter, partNumber)
string: The dimension or text to be split into parts
delimiter: The text representing the delimiter to split by
partNumber: The requested part of the split (starts at 1)
Example: Split_part(SKU, '-', '2') → "PREM-01-GOLD" returns "01"
Date functions
Date functions help you extract or reshape dates for time-based reporting. When using them, you must specify the date field to use, such as the shared Date dimension or a field like Customer First Order Date or Order Processed Date.
When using date functions, you need to specify which date to use. This will typically be a dimension like:
Date → the shared date dimension that automatically uses the date range selected in your report.
Customer First Order Date, Order Processed Date, etc. → specific dimensions from your data.
Day - Returns the day of the month.
Format: Day(date)
Example: Day(Order Date) → "2022-04-10" → 10
Week / Month / Quarter / Year - Assigns a number to the week, month, quarter, or year.
Format: Week(date) / Month(date) / Quarter(date) / Year(date)
Example: Week(Date) → "2022-04-10" → 15
Day Name - Returns the name of the weekday.
Format: DayName(date)
Example: DayName(Date) → "Tuesday"
Day of Week - Returns a number from 0 (Sunday) to 6 (Saturday).
Format: DayOfWeek(date)
Example: DayOfWeek(Date) → "2022-04-10" → 0 (Sunday)
Current Timestamp - Returns the current timestamp in UTC
Format: Current_timestamp()
Example: Current_timestamp() -> "2025-08-28 12:15:32"
Date - Returns the calendar date part of a timestamp
Format: Date(Date)
Example: Date(Date) -> "2025-08-28 12:15:32" -> "2025-08-28"
CONVERT_TIMEZONE - Convert a timestamp in UTC to a target timezone
Format: Convert_timezone(Timezone, Date)
Example: Date(Date) -> "Europe/Paris", "2025-08-28 12:15:32" -> "2025-08-28 14:15:32"
DATEADD - Add a number of days, weeks, months etc. to a date
Format: Dateadd(Date Part, Amount, Date)
date_part: The unit of time (year, month, day, quarter)
amount: How many of date_part to add (negative values for subtraction)
date: The date to operate on
Example Dateadd(Date Part, Amount, Date) -> 'day', 2, '2025-08-28' -> '2025-08-30'
DATEFORMAT - Format a date using Snowflake formatting
Format: Dateformat(Date, Format)
Example: Dateadd(Date, Format) -> '2025-08-28', 'MMMM' -> 'August'
Date Diff - Returns the difference between two dates.
Format: Datediff(date_part, date1, date2)
date_part: The unit of time (year, month, day, quarter)
date1: The first value to compare
date2: The second value to compare
Example: Datediff('day', Processed date, Updated day) → "2022-01-01" and "2022-01-10" = 9
Date Trunc - Rounds a date down to the specified granularity.
Format: Datetrunc(date_part, date)
date_part: The unit of time (year, month, day, quarter)
date: The date to be truncated
Example: Datetrunc('month', date) → "2022-01-15" → "2022-01-01"
Math Functions
Math functions let you calculate or standardize numeric values in Custom Dimensions.
POW - Calculate the power of a number
Format: Pow(Base, Exponent)
Example: Pow(Base, Exponent) -> 2, 4 -> 16
DIV0 - Calculate the division between two numbers. Fall back to 0 if the denominator is 0.
Format: Div0(Base, Exponent)
Examples:
Div0(Base, Exponent) -> 2, 4 -> 0.5
Div0(Base, Exponent) -> 6, 0 -> 0
MOD - Calculate the rest of the integer division between two numbers.
Format: Mod(Base, Exponent)
Example: Mod(Base, Exponent) -> 5, 3 -> 2
ABS - Calculate the absolute value of a number.
Format: Abs(Value)
Example: Abs(Value) -> -3 -> 3
ROUND - Round a number.
Format: Round(Value)
Example: Round(Value) -> 1.7 -> 2
FLOOR - Calculate the floor of a number.
Format: Floor(Value)
Example: Floor(Value) -> 1.7 -> 1
CEIL - Calculate the ceiling of a number.
Format: Ceil(Value)
Example: Ceil(Value) -> 1.7 -> 2
Using Regex (with Examples)
For more advanced use cases, Custom Dimensions also support regex-based extraction through the Regexp(subject, pattern) function. This is helpful when values are embedded inside structured text, JSON-like strings, notes, or tags.
Regexp - Extracts text based on a regex pattern.
Format: Regexp(subject, pattern)
subject: The dimension or string on which you want to apply the regex
pattern: The regular expression or the text that precedes the string you want to extract followed immediately by ([^ ]*) or ([^"]*)
Example: Regexp(Order Line Properties, '{"name":"Color","value":"([^"]*)') -> Extracts "Blue" from: [{"name":"Color","value":"Blue"}]
Example: Regexp(Notes, 'Duties and Fees: ([^ ]*)') -> Extracts "17.39" from: Duties and Fees: 17.39 GBP
⚠️ Tip: If copying ([^"]*), ensure your quotation marks stay straight quotes (") and not curly quotes (“”) — some browsers may auto-format them incorrectly.
Examples & Use Cases
Analyze Total Sales by Day of the Week
If you'd like to break down your Total Sales by the day of the week they were processed (to identify your highest sales days over a given period), you can use a Custom Dimension like this:
What this does:
If there's a valid Order Processed Date, it returns the day of the week (e.g. Monday, Tuesday).
If no date is available, it returns "No Data - Extend date range" as a fallback.
Note: The specific date range rule applied to the Order Processed Date doesn’t matter much—what’s important is that your report covers a wide enough date range to include meaningful data.
Once this Custom Dimension is created, add it as a breakdown in a Custom Report alongside Total Sales. You’ll instantly see which days drive the most revenue.
Example Insight:
In the sample report below, Saturdays had the highest Total Sales, while Tuesdays had the lowest—helping you identify weekly patterns and plan accordingly.
Add Labels to Week Numbers Using Concat
If you want to track performance by week, labeling your weeks clearly can help you compare trends more easily across months or years.
For example, if you're analyzing sales or sessions on a weekly basis, adding a prefix like "W-" to your week numbers makes charts and tables easier to read and interpret at a glance.
You can do this using the Concat function:
What this does:
Week((Date)) pulls the week number from a date (e.g. "2022-04-10" becomes 15).
Concat("W-", ...) adds the "W-" prefix to make the output easier to interpret in your reports.
Tip: This kind of labeling is especially helpful when visualizing data by week in bar charts or tables—clearer labels make insights easier to spot.
Key Takeaways
Custom Dimensions in Polar Analytics give you a powerful way to turn raw data into meaningful, actionable insights. By combining When / Then / Else logic with operators and functions, you can clean, categorize, and transform your data directly within your reports—without needing external tools.
To get the most value, start with simple rules, validate your outputs, and gradually layer in more advanced functions like date formatting, math calculations, or regex extraction. Small improvements in how your data is structured can lead to much clearer reporting and better decision-making.
As you build more Custom Dimensions, you’ll be able to tailor your analytics to match your exact business needs—making your dashboards more intuitive, scalable, and insightful.