Window

RATIO_TO_REPORT

SnowflakeSnowflake

Menghitung rasio nilai terhadap total dalam partition.

Tipe hasil: DOUBLEDiperbarui: 6 Jan 2026

Syntax

SQL
RATIO_TO_REPORT(expr) OVER ([PARTITION BY ...])

Parameter

exprnumericwajib

Expression numerik

Contoh Penggunaan

Sales Percentage

SQL
1SELECT
2 product_name,
3 sales,
4 RATIO_TO_REPORT(sales) OVER () as pct_of_total,
5 RATIO_TO_REPORT(sales) OVER (PARTITION BY category) as pct_of_category
6FROM products;

Persentase sales dari total dan per kategori.