Langsung ke konten
Skillpedia
Analisis & spreadsheet6.2k · #14397

filter-expressions

Fungsinya

Skill ini menjelaskan cara menulis ekspresi filter untuk alat kueri Lightdash. Skill ini untuk analis dan pengembang yang membuat kueri dengan filter baris atau filter metrik bersyarat.

Kapan dipakai

  • ✓Saat Anda perlu memfilter kueri Lightdash hanya untuk baris tertentu.
  • ✓Saat Anda ingin metrik kustom hanya menghitung baris yang memenuhi suatu syarat.
  • ✓Saat Anda mencari nilai field dengan filter di Lightdash.

Link skill

https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/filter-expressions/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/filter-expressions/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Jalankan kueri Lightdash untuk total pendapatan, tetapi hanya sertakan pesanan dari wilayah Utara dengan status selesai.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill menjelaskan cara menempatkan setiap ekspresi filter pada kategori yang tepat, seperti dimensi, metrik, atau kalkulasi tabel. Skill juga memperingatkan agar tidak menambahkan field yang hanya dipakai untuk memfilter ke dalam pengelompokan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

<!-- Generated by pnpm -F backend generate:filter-expression-skill. -->

Read this before writing filters for expression-enabled tools. It does not apply to tools whose schemas use structured filter objects. Follow each tool's input schema; this skill does not enable unavailable tools or filter modes.

Filter Expressions

For run_metric_query, set queryConfig.filters to null when no query filters are needed. Otherwise, dimensions, metrics, and tableCalculations are independent string expressions or null.

  • A non-null category contains one raw string expression.
  • Choose the category from discovered field metadata (its dimension/metric kind), never from a field name or whether a numeric field sounds metric-like. A raw numeric dimension belongs in dimensions; only metrics and custom metrics belong in metrics.
  • A field used only to restrict rows stays in its filter expression. Do not add it to queryConfig.dimensions unless the user asked to group by or display it: extra selected dimensions change aggregation and table-calculation grain.
  • Table calculations belong only in tableCalculations.
  • Each category is flat and uses AND or OR, never both.
  • The three categories combine implicitly with AND.
  • Aggregation custom metric filters are flat AND expressions.
  • Omit search_field_values.filters for an unscoped search. When present, it is one flat dimension expression string and is AND-only.
  • The tool schema is authoritative for where each string is placed.

Raw placement examples:

  • dimensions: orders_status equals=completed,shipped AND orders_order_date inThePast=2{unit:weeks,completed:true}

  • dimensions (alternatives): orders_promo_code startsWith=VIP OR orders_promo_code endsWith=25

  • metrics: orders_total_order_amount greaterThan=100

  • tableCalculations: rank lessThanOrEqual=10

  • Join flat rules with AND or OR. Do not mix both connectors in one expression.

  • Bare scalars work. Double-quote reserved and whitespace/punctuation strings (apostrophes/parentheses); quote when unsure. Quoted commas/braces literal; backslash escapes. E.g. orders_product_name equals="Coffee Filters (100pk)".

  • Limits: 256 rules; 256 values including settings/rule; 256 characters/literal; 16384 characters/expression.

string

Grammar: <field> <operator form>

  • isNull [0 values]
  • notNull [0 values]
  • equals=<value>[,<value>...] [1+ values]
  • notEquals=<value>[,<value>...] [1+ values]
  • startsWith=<value>[,<value>...] [1+ values]
  • endsWith=<value>[,<value>...] [1+ values]
  • include=<value>[,<value>...] [1+ values]
  • doesNotInclude=<value>[,<value>...] [1+ values]

number

Grammar: <field> <operator form>

  • isNull [0 values]
  • notNull [0 values]
  • equals=<value>[,<value>...] [1+ values]
  • notEquals=<value>[,<value>...] [1+ values]
  • lessThan=<value> [1 value]
  • lessThanOrEqual=<value> [1 value]
  • greaterThan=<value> [1 value]
  • greaterThanOrEqual=<value> [1 value]
  • inBetween=<first value>,<second value> [2 values]
  • notInBetween=<first value>,<second value> [2 values]

date

Grammar: <field> <operator form>

  • isNull [0 values]
  • notNull [0 values]
  • equals=<value>[,<value>...] [1+ values]
  • notEquals=<value>[,<value>...] [1+ values]
  • lessThan=<value> [1 value]
  • lessThanOrEqual=<value> [1 value]
  • greaterThan=<value> [1 value]
  • greaterThanOrEqual=<value> [1 value]
  • inThePast=<count>{unit:<unit>,completed:<bool>} [1 count; settings required]
  • notInThePast=<count>{unit:<unit>,completed:<bool>} [1 count; settings required]
  • inTheNext=<count>{unit:<unit>,completed:<bool>} [1 count; settings required]
  • inTheCurrent=<unit>[{toDate:true[,excludeToday:true]}] [1 unit; settings optional]
  • notInTheCurrent=<unit>[{toDate:true[,excludeToday:true]}] [1 unit; settings optional]
  • inBetween=<first value>,<second value> [2 values]
  • Units: days, weeks, months, quarters, years; completed=false includes partial, true completed only.
  • Current-period bounds: {toDate:true} ends the current week/month/quarter/year at today ("month to date"); {toDate:true,excludeToday:true} ends it at yesterday (today's partial data excluded). Not valid for days.

boolean

Grammar: <field> <operator form>

  • isNull [0 values]
  • notNull [0 values]
  • equals=<value> [1 value]
  • notEquals=<value> [1 value]
Pertanyaan umum

Di mana filter diletakkan?

Setiap filter diletakkan di kategori yang sesuai dengan field-nya, seperti dimensi atau metrik.

Apakah filter mengubah pengelompokan?

Hanya jika Anda menambahkan field itu ke pengelompokan, jadi skill menyarankan agar field yang hanya untuk filter tidak dimasukkan.

Apakah semua mode filter tersedia?

Skill mengikuti skema input setiap alat, jadi hanya mode yang didukung alat tersebut yang berlaku.

Detail

Deskripsi asli dari pembuat

Author filter expressions for run_metric_query and search_field_values, including conditional custom metric filters.

repo: lightdash/lightdash

Popularitas

Bintang GitHub
6.2k
Peringkat
#14397
Lisensi
—
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa