OpenBI Docs Buy

BOXPLOT OpenBI

A distribution's box in one row: count, quartiles, whiskers (1.5 IQR), mean and outliers, as R's quantile type 7 and ggplot2 give them.

Group: Statistics. OpenBI’s own: DAX has no function of this name.

Syntax

BOXPLOT ( <table>, <value> )
ParameterTypeDescription
tableTableThe rows whose values make the box.
valueExpression
evaluated for each row
The number worked out for each row.

Returns

Table. One row. Count; the five-number summary Min, Q1, Median, Q3 and Max; Mean; Lower whisker and Upper whisker; and Outliers, how many values lie beyond the whiskers.

Remarks

  • The quartiles are those of PERCENTILE.INC: R's quantile of type 7, which ggplot2's box plots also use. Pick the columns you need with SELECTCOLUMNS, as the examples do.
  • Each whisker reaches the furthest value that is still within 1.5 times the box's height (Q3 − Q1) of the box. Values beyond them are outliers.
  • Blank results are left out. With no value at all, Count and Outliers are 0 and the other columns blank.
  • Text is an error. For one box per group, put it in GENERATE with CALCULATETABLE, as in the last example.

Compared with DAX

An OpenBI function: DAX has none like it, so a measure or query that uses it works in OpenBI only, not in Power BI or Analysis Services.

Examples

Ten delivery times, one of them late

45 minutes lies beyond the upper whisker at 22: one outlier.

EVALUATE
VAR Times =
    DATATABLE (
        "Minutes", INTEGER,
        { { 12 }, { 14 }, { 15 }, { 15 }, { 16 }, { 18 }, { 19 }, { 21 }, { 22 }, { 45 } }
    )
RETURN
    SELECTCOLUMNS (
        BOXPLOT ( Times, [Minutes] ),
        "Count", [Count], "Min", [Min], "Q1", [Q1], "Median", [Median], "Q3", [Q3], "Max", [Max],
        "Mean", [Mean], "Lower whisker", [Lower whisker], "Upper whisker", [Upper whisker],
        "Outliers", [Outliers]
    )
CountMinQ1MedianQ3MaxMeanLower whiskerUpper whiskerOutliers
1012151720.54519.712221

Crates per place

The depot's 0 crates is the outlier; the lower whisker stops at the smallest shop, 7.

EVALUATE
SELECTCOLUMNS (
    BOXPLOT ( Places, Places[Crates] ),
    "Lower whisker", [Lower whisker],
    "Q1", [Q1],
    "Median", [Median],
    "Q3", [Q3],
    "Upper whisker", [Upper whisker],
    "Outliers", [Outliers]
)
Lower whiskerQ1MedianQ3Upper whiskerOutliers
7911.514181

A box per product, of its months

EVALUATE
SELECTCOLUMNS (
    GENERATE (
        VALUES ( Products[Product] ),
        CALCULATETABLE ( BOXPLOT ( VALUES ( Sales[Month] ), [Liters sold] ) )
    ),
    "Product", Products[Product],
    "Q1", [Q1],
    "Median", [Median],
    "Q3", [Q3],
    "Outliers", [Outliers]
)
ORDER BY [Product]
ProductQ1MedianQ3Outliers
Cider751178408851.52
IPA8200863298141
Lettøl4249.54445.54973.51
Pils24383.526964308170

HISTOGRAM, DENSITY, PERCENTILE.INC, MEDIAN.

Last updated · OpenBI Studio 0.3.74