Create a variable for use in expressions in a Part Studio, and assign a value. Use the variable in dimensions and expressions. Variables are features in Onshape, so the placement in the Feature list is important. Create a variable before the feature in which you will use it or create it on the fly during an operation that needs the value.

For additional Learning center resource, follow the technical briefing article here: Parametric Variables vs Configuration Variables (Onshape account required). You can also register for the following course: Variables and Expressions (Onshape account required).