本文へスキップ
Skillpedia
分析とスプレッドシート6.2k · #14401

table-calculations

できること

Lightdashの指標クエリのテーブル計算の書き方を説明します。クエリ結果の上に、比較、割合、順位を加えたいアナリスト向けです。

使う場面

  • ✓Lightdashのクエリで、比率や全体に対する割合が必要なとき。
  • ✓結果の累計、移動平均、順位がほしいとき。
  • ✓期間ごとの変化や、各グループの上位の項目が必要なとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/table-calculations/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“月次売上のLightdashのクエリに、累計の列と、前月からの変化の列を追加してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

スキルは、テーブル計算で使われる表計算のような数式の構文を説明します。選択したフィールドや他の計算を参照する方法と、パーセントの書式オプションの使い方を示します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Table calculations

For run_metric_query, author queryConfig.tableCalculations as type formula. The input schema documents the syntax and required fields; use spreadsheet-like formulas, not raw SQL.

Calculations operate on query results after aggregation. Reference selected field IDs or other table calculation names. The names below are placeholders: replace them with the actual fields or calculations in your query. Do not add grouping dimensions unless the user requested that grain.

When to use them

  • Arithmetic across metrics: metric_a + metric_b, ratios metric_a / metric_b.
  • Aggregating already-aggregated metrics (e.g., average of monthly totals): AVG(metric).
  • Percent of total: m / SUM(m).
  • Period-over-period: (m - LAG(m, ORDER BY date)) / LAG(m, ORDER BY date).
  • Rankings: RANK(ORDER BY m DESC).
  • Running totals: RUNNING_TOTAL(m, ORDER BY date).
  • Trailing 3-period average: MOVING_AVG(m, 2, ORDER BY date). The second argument counts preceding rows; the current row is also included.
  • Top N per group: ROW_NUMBER(PARTITION BY group, ORDER BY m DESC), then filter on that calculation.

Use the schema's formatting options for ratios and percentage changes; do not multiply a fraction by 100 when using percent formatting.

よくある質問

テーブル計算はSQLですか?

いいえ。生のSQLではなく、クエリ結果に対して働く表計算のような数式です。

グループ化が変わりますか?

いいえ。結果に対して働き、頼まれない限り、グループ化のフィールドは追加しません。

パーセントはどう表示しますか?

100を掛けるのではなく、パーセントの書式オプションを使います。

詳細

作者による元の説明

Author formula table calculations for run_metric_query, including ratios, aggregate comparisons, windows and rankings.

repo: lightdash/lightdash

人気

GitHubのスター
6.2k
ランキング
#14401
ライセンス
—
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル