Chris Potts
10/09/2026, 3:49 PMkapa.ai
10/09/2026, 3:49 PMCAST or type-conversion function in MAQL for converting a string to a number.
However, depending on your use case, there are a couple of approaches worth considering:
Option 1: Use a Computed Attribute with CASE/WHEN If you need to compare a string-stored number to integer thresholds and bucket the results, you can use a computed attribute with MAQL's CASE/WHEN logic directly against the string label:
SELECT
CASE
WHEN {label/your_string_field} = "1" THEN "Category A"
WHEN {label/your_string_field} = "2" THEN "Category B"
ELSE "Other"
END
This avoids needing a numeric cast by comparing string values directly. [Computed Attributes]
Option 2: Use Relational Operators on the String Label MAQL supports =, <>, IN, and NOT IN comparisons on attribute labels. If your values are discrete, you can filter using string equality: [Relational Operators]
SELECT {metric/my_metric} WHERE {label/your_string_field} IN ("100", "200", "300")
Option 3: Handle the Transformation Upstream The most robust approach â especially if you need true numeric comparisons (e.g., > 500) â is to cast the column to a numeric type in your data warehouse/ETL layer and expose it as a fact in the Logical Data Model. MAQL operates on the LDM and does not perform type casting natively.
In summary, MAQL does not appear to support an explicit CAST or type-coercion function. If string-to-integer comparison is critical, the upstream transformation approach is the most reliable path. đ 0 button đ 0 button âšī¸ Tip: Mention @kapa.ai in the thread for follow-ups.
đ Our Support team monitors all messages and will jump in if needed.Michael Ullock
10/09/2026, 4:08 PM