### How to create S- or R-chart

This help page describes how you can create S- or R-chart in Power BI, using the Craydec Control Charts.

#### What are they / When to use

S- or R-chart is used when you have sample of items, which you typically gather at regular intervals, and you take a some measure of these items. Typically you would have production process and you inspecting the items for quality. The sample size is typically fixed or does not vary much.

S- and R-charts differ in their use of dispersion (variability) estimator. The S-chart uses standard deviation, and R-chart uses range. In practice there is little difference between the charts, unless the sample size is large.

#### Creating the chart

**Data roles required**

x, measured value

*Example data. This data is used in the downloadable example report.*

Data roles:

row_id = x, value = measured value, sample_id = subgroup (for non-fixed subgrouping)

##### Steps

**1) Add visual to the report**

See the Microsoft’s documentation.

**2) Prepare data**

See the Microsoft’s documentation.

Note that measured valued must be numeric data type. X can be number, text, or date, but it must sort the data correctly. It is also good idea to have unique values for x in each row, unless ‘Row ID’ is used.

**3) Add data roles**

Select data roles. As the order of the data is crucial for the correct visualization, it is safest to start by selecting ‘id’ or ‘x’ data role first.

**Subgroup size: fixed or variable**

If using a variable subgroup size, you should add a variable to ‘step / subgroup’ data role. If data role is not selected, the default of subgroup size (2) is used.

Note: when using variable subgroup sizes, you can add two data roles to the ‘step / subgroup’ data role. First data role is used for subgroups and the second is used to indicate a step (change in process).

**4) Enter a license code**

See the help video.

**5) Change chart type**

Select *Format > Chart > Chart Type > ‘S-chart’ or ‘R-chart’*, depending on which chart you want to create. You have to have a valid license to change the chart type.

**6) Set subgroup sizes**

Both charts require that subgroup sizes are defined. Subgroup sizes should be fixed, unless it is not possible. If subgroup sizes are variable, the sizes of groups should be as close to each other as possible, as the subgroup size has effect on the limits (UCL/LCL). For variable subgroup sizes the limits are calculated for average subgroup size.

**7) Check the results**

Look at the results and check if they are plausable. Also make sure the data is in correct order.

If you are unsure, try to recreate some of our example reports to gain confidence.

**Common errors**

See separate common errors page.

##### Examples

See the example report. Data contains fictional data set.