Skip to content

Advanced Techniques

Master advanced PXL patterns using the available functions and complex filtering expressions.

PXL provides six core functions for data transformation and text analysis:

  • filter(): Filter data based on conditions
  • ntile(): Create distribution tiles/quantiles
  • extract(): Extract specific information from text
  • classify(): Classify text into categories
  • score(): Create sentiment scores between two poles
  • word_count(): Count words in text columns
filter(revenue >= 1000)
filter(age > 25 and age < 65)
filter(score != 0)
filter(rating == 5)
filter(customer_type is "premium")
filter(status is not "cancelled")
filter(product_name like "iPhone")
filter(description not like "old")
filter(email != "")
filter(region in ("US", "Canada", "Mexico"))
filter(status not in ("cancelled", "refunded"))
filter(category in (1, 2, 3, 4))
filter(order_date after "2024-01-01")
filter(created_at before "2024-12-31")
filter(delivery_date between "2024-01-01" and "2024-03-31")
filter(revenue > 1000 and customer_type is "premium")
filter(status is "active" or last_login after "2024-01-01")
filter(age >= 18 and (country is "US" or country is "CA"))
extract("email addresses" from customer_notes)
extract("product names" from review_text)
extract("dollar amounts" from transaction_descriptions)
classify(feedback_text into (
"positive": "happy, satisfied, great experience",
"negative": "frustrated, disappointed, poor service",
"neutral": "factual, informational, no strong emotion"
))
classify(support_tickets into (
"billing",
"technical",
"feature_request",
"complaint"
))
score(review_text from "terrible" to "amazing")
score(employee_feedback from "dissatisfied" to "highly_engaged")
score(product_reviews from "hate" to "love")
word_count(product_description)
word_count(customer_comments)
ntile(revenue, 4) // Create quartiles
ntile(age, 10) // Create deciles
ntile(score, 100) // Create percentiles

Functions can be chained using the -> operator:

filter(customer_type is "premium") ->
extract("product mentions" from feedback_text)
filter(revenue > 10000) ->
score(satisfaction_survey from "very_dissatisfied" to "very_satisfied")
filter(order_date after "2024-01-01") ->
classify(support_tickets into ("billing", "technical", "shipping"))
// High-value customers with recent activity
filter(lifetime_value > 5000 and last_purchase after "2024-01-01")
// Premium customers with complaints
filter(tier is "premium") ->
classify(feedback into ("complaint", "praise", "suggestion", "question"))
// Recent product reviews
filter(review_date after "2024-06-01") ->
score(review_text from "disappointed" to "delighted")
// Extract features mentioned in feedback
filter(product_category in ("electronics", "software")) ->
extract("specific features mentioned" from customer_feedback)
// Weekend vs weekday analysis
filter(order_date between "2024-01-01" and "2024-12-31") ->
ntile(order_total, 5)
// Seasonal pattern analysis
filter(created_at between "2024-12-01" and "2024-12-31") ->
extract("holiday mentions" from customer_messages)
  • Column names: customer_id, order_date, revenue
  • Special identifier: $ (refers to current dataset)
  • Strings: Must be quoted with double quotes "premium"
  • Numbers: Support integers and decimals 1000, 99.99, -5
  • Dates: ISO format "2024-01-01" or with time "2024-01-01T10:30:00"
  • Booleans: true, false (case insensitive)
  • Null: null
  • Comparison: >, <, >=, <=, ==, !=
  • String: is, is not, like, not like
  • Set: in, not in, contains
  • Temporal: before, after, between
  • Boolean: and, or
  • Chaining: -> (connects function outputs)
  • Function parameters: filter(condition)
  • Boolean grouping: (condition1 or condition2) and condition3
  • Lists: ("value1", "value2", "value3")

Common syntax errors to avoid:

// ❌ Incorrect - missing quotes around strings
filter(status is premium)
// ✅ Correct - strings must be quoted
filter(status is "premium")
// ❌ Incorrect - wrong date format
filter(date after "01/01/2024")
// ✅ Correct - use ISO date format
filter(date after "2024-01-01")
// ❌ Incorrect - missing parentheses
filter revenue > 1000
// ✅ Correct - function calls need parentheses
filter(revenue > 1000)

Function Reference

Explore detailed examples and parameters for each PXL function.

Spreadsheet Interface

Learn how to use PXL within the spreadsheet interface for interactive data transformation.