Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Computes the sample skewness of input values, with a bias correction for finite samples. Skewness measures the asymmetry of a distribution: positive values indicate a longer right tail, negative values indicate a longer left tail, and zero indicates a symmetric distribution.
Syntax
skewness_samp(<expression>)
Arguments
Required
<expression>: An expression of any numerical type.
Returns
Returns a double precision value.
Returns NULL when fewer than three non-null input values are provided or when all non-null values are identical.
Considerations
- Use
SKEWNESS_SAMPwhen the data is a sample drawn from a larger population, the typical analytics case. UseSKEWNESS_POPwhen the data is the complete population of interest. - Uses the adjusted Fisher–Pearson coefficient of skewness, with finite-sample bias correction.
- Converges with
SKEWNESS_POPfor large row counts. - Ignores NULL inputs. Any NaN or infinite input propagates to a NaN result.
Examples
Calculate Sample Skewness
Estimate the skewness of service latency from a sampled slice of requests.
SELECT skewness_samp(latency_ms) AS latency_skew
FROM request_log_sample;
Skewness by Group
Compare the asymmetry of claim amounts across policy lines.
SELECT policy_line, skewness_samp(claim_amount) AS claim_skew
FROM claims
GROUP BY policy_line;