# Change the measures (Analytics)

{% hint style="info" %}
User permission: Query > Change Measures
{% endhint %}

Measures are different types of numerical data values that are displayed in the grid. They can be *calculated* or *non-calculated* (raw data). Typical measures you might see in a Sales database are listed below. The measures you have might be different from these.

| Measure    | Data or value displayed                                            | Data source |
| ---------- | ------------------------------------------------------------------ | ----------- |
| Value      | Value of sales (sales value)                                       | Raw data    |
| Cost       | Cost of sales (cost price)                                         | Raw data    |
| Quantity   | Quantity of items sold                                             | Raw data    |
| Profit     | Profit as a dollar or pound value (Value–Cost).                    | Calculated  |
| Margin     | Margin as a percentage (Profit/Value).                             | Calculated  |
| Value/Item | Average sales value per item (Value/Quantity)                      | Calculated  |
| Cost/Item  | Average cost per item (Cost/Quantity)                              | Calculated  |
| Lines      | The number of transactions lines imported into the Phocas database | Raw data    |

In values in the **Total** row of calculated measures are not actually totaled; the calculation is applied to the total data.

The **Measures** menu identifies the selected measure. When you first open a database or reset the data during your analysis, the default measure is selected. Typically, in a Sales database, the default measure is **Value**. If multiple measures are selected, a summary displays. You can hover over the **Measures** menu to display a tooltip listing all the selected measures.&#x20;

## View measures in Summary view <a href="#changethemeasures-viewmeasuresinsummaryview" id="changethemeasures-viewmeasuresinsummaryview"></a>

In Summary view, the values you see in the grid correspond to the default measure, so you can see a summary of that measure (**Local Values**) across the period. You can switch to a different measure, such as **Cost** or add multiple measures columns to the grid to view all of those high-level data values.

<figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/Xyu0cjTxtJFQ3dUXxNzc/3005776032.png" alt=""><figcaption></figcaption></figure>

## View measures in a filtered view <a href="#changethemeasures-viewmeasuresinafilteredview" id="changethemeasures-viewmeasuresinafilteredview"></a>

When you select a dimension, the grid displays columns for the active properties (such as **Code** and **Name**) for that dimension, along with additional columns displaying data for the default measure. The columns that display depend on the selected mode. If you select more than one measure, more columns will display.

In the context of a filtered view, the measures are data values relating to the selected dimension. You can switch to a different measure or add multiple measures to view those additional data values in the grid.

<figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/B0F0JeV695ZF8j7gCYNm/3005416131.png" alt=""><figcaption></figcaption></figure>

## Add and remove measure columns <a href="#changethemeasures-addandremovemeasurecolumns" id="changethemeasures-addandremovemeasurecolumns"></a>

The **Measures** menu has a list of all the measures in the database, however, only the measures that contain data are available for selection. Typically, in a Sales stream, all measures are available but if, for example, you switch to a Budget stream, you will see that your choice of measures is limited.

When you are in an advanced search or Custom mode, all measures are available (even if they don't contain any data).&#x20;

1. In Summary view or when you have selected a dimension (as applicable), click the **Measures** menu.
2. Select the checkboxes of the measures you want to add to the grid and clear the checkboxes of the measures you do NOT want.
3. Click anywhere outside the **Measures** menu to update the grid and view the new measures.

{% hint style="success" %}
To quickly select and apply one measure only, double click that measure in the list.
{% endhint %}

{% hint style="info" %}
If you select multiple measures:

* The number of columns in the grid increases accordingly, making your view more complex. Use [Total mode](https://docs.phocassoftware.com/analytics/customize-your-view-analytics/change-the-mode/total-mode) to simplify the view.
* Some chart types might not be available.&#x20;
  {% endhint %}

## Format a measure  <a href="#changethemeasures-formatameasure" id="changethemeasures-formatameasure"></a>

{% hint style="info" %}
User permission: Query > Format Measures
{% endhint %}

By default, the measures display in the format your administrator set in the Designer module. You can override this format and customize the appearance of the measures to meet your personal needs. You can select from a list of predefined format options, which include the use of decimal places, thousand separators, and percentage symbols. If none of those options meet your needs exactly, you can create a custom format that can contain a prefix and/or suffix, such as a currency symbol. For example, you might want to remove the thousands to save space in the grid, so 4,000 becomes 4, 57,300 becomes 57.3, and so on.

Click the **Measures** menu, then click the **Formatting** option at the bottom of the measures list. In the **Measures Formatting** window, edit the default format of each measure, as required. You can use a predefined or custom format, as described below. Then click **Apply**.

{% hint style="info" %}
The measure formatting is stored in the site database and works across all your devices. The formatting will remain until you change it, even if you log out.
{% endhint %}

In the image below, compare the default appearance of data in the **Local Value** column with the customized format of the data in the **Local Cost** column (it has dollar signs and no decimal places).&#x20;

<div align="left"><figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/wvNSxNZ0JI0PUV2LcYTO/3005155503.png" alt="" width="510"><figcaption></figcaption></figure></div>

### Use a predefined format

Click the **Formatting** button (it might say **Default** or something like **1,234.57**) to view your options and select the required format.

<div align="left"><figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/doMbZE5HqWUzl59hSqqm/3005808929.png" alt="" width="72"><figcaption></figcaption></figure></div>

### Apply a custom format

Click the **Formatting** button and select the **Custom** option, then select one of these methods:

* Manually enter the required format into the box. For example:
  * To remove thousands, enter: #,##0,.00&#x20;
  * To remove thousands and use K as a descriptor, enter: 0,0,.00,"K"
  * To remove millions, enter: #,##0,,.00
  * To display negative figures in parentheses, enter: #,0.00;(#,0.00);0.00
* Click the **More options** button and specify a prefix, suffix and/or number decimal places, and select the separate thousands checkbox, if required, then click **Apply**.

## Hide a measure <a href="#changethemeasures-hideameasure" id="changethemeasures-hideameasure"></a>

By default, all measures are set to **Visible**, so they display in the list in the **Measures** menu. You have the option to set a measure as NOT visible, in other words, hide the measure from the list. This option is useful when the database has a lot of measures and therefore, the list of measures is very long but you are only ever interested in some of those measures. You can remove the redundant measures from the list, so you can find the ones you want more easily.

Click the **Measures** > **Formatting** and clear (deselect) the **Visible** checkbox for the measure.

<div align="left"><figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/HsyM4NQviPysQ0ogf2ws/3005383441.png" alt="" width="454"><figcaption></figcaption></figure></div>

## Define a measure <a href="#changethemeasures-defineameasure" id="changethemeasures-defineameasure"></a>

{% hint style="info" %}
The information in this section relates to other Phocas functions and is referenced by other user documentation pages.
{% endhint %}

When you use [Custom mode](https://docs.phocassoftware.com/analytics/customize-your-view-analytics/change-the-mode/custom-mode) and create some [advanced search rules](https://docs.phocassoftware.com/analytics/search-for-data/advanced-search), you need to define a measure by applying parameters such as time period, stream, format and filter selections.&#x20;

The first thing to be aware of is the **Measure** button will not say *Measure* on its label. It will be named differently depending on the default measure set in the database you are in. For example, if you are in a Sales database this button will say something like *Sales Local Value*. However, when you hover over the button it displays *Measure* in a tooltip.

<div align="left"><figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/DY9FiOn5iHCMfXAMHd9r/3005448718.png" alt="" width="272"><figcaption></figcaption></figure></div>

When you click the **Measure** button, the **Measure** window displays. This is where you define the measure, using the settings that are organized into three tabs. The combination of these settings determines the value of the measure.

{% tabs %}
{% tab title="Measure" %}

1. Select the [stream](https://docs.phocassoftware.com/analytics/customize-your-view-analytics/change-the-stream) you want your measure to come from (if available).&#x20;
2. Select the [measure](https://docs.phocassoftware.com/analytics/customize-your-view-analytics/change-the-measures-analytics). Only the measures in the current database will be displayed.
3. Select **Actual** or **Daily Average** [format](https://docs.phocassoftware.com/analytics/customize-your-view-analytics/change-the-data-format). **Apply**.

<div align="left"><figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/2jNfhNvlfVKh0qx8mpkE/3005416220.png" alt="" width="209"><figcaption></figcaption></figure></div>
{% endtab %}

{% tab title="Period" %}
This optional setting allows you to add a time period to a measure. If you skip this option, either the default or active period will apply to your measure.

1. Choose a time unit (month, day, year) from the list of available [defined periods](https://docs.phocassoftware.com/analytics/customize-your-view-analytics/change-the-period-analytics).
2. Enter a start date and end date. These can be fixed dates (such as January 2016) or [offset dates](https://docs.phocassoftware.com/analytics/customize-your-view-analytics/broken-reference). **Apply**.&#x20;

<div align="left"><figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/rqKVquGNAJpVPLMpjLG4/3005416230.png" alt="" width="209"><figcaption></figcaption></figure></div>
{% endtab %}

{% tab title="Settings" %}
This optional setting allows you to further refine the measure by making additional selections on a dimension to act as a filter for the values being calculated.

Select a dimension, then select the required entities within that dimension.

<div align="left"><figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/BTuMYA0ztwNZMujc8Tg0/3005579654.png" alt="" width="196"><figcaption></figcaption></figure></div>

This setting is particularly important when you are defining a measure in an advanced search based on filtered data, as it ensures you get the expected results.
{% endtab %}
{% endtabs %}

## Add a Count column <a href="#changethemeasures-addacountcolumn" id="changethemeasures-addacountcolumn"></a>

The Count feature displays specific count results as another measure column in the grid. Adding a ‘count’ column is simple way to see totals related to a dimension, such as the number of products customers are buying or the number of customers in a region.

{% hint style="info" %}
The Count feature is available in Total, Period, Variance and Stream modes, when you have selected a dimension.
{% endhint %}

In the following example, you add count columns to identify how many products were bought by each customer.

1. Click the **Customer** dimension.
2. Click **Mode** > **Total**.
3. Click **Measures** > **Count** and select **Product**. The options in the **Count** list are the same as the dimensions that you see down the left-hand side of the grid. This is because Phocas is counting entities within the datasets that make up dimensions.

   <div align="left"><figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/JpKvfzAGaQIttrGOLiSx/3016917198.png" alt="" width="340"><figcaption></figcaption></figure></div>
4. Click anywhere outside the **Measures** menu to update the grid and view the new Count column.

   <figure><img src="https://content.gitbook.com/content/itAvDF3MljQXV0rjHRP7/blobs/JdvqWWEemyptPgM8m2tk/3017211988.png" alt=""><figcaption></figcaption></figure>
5. (Optional) Visualize the data in a chart or save your view as a favorite.

{% hint style="warning" %}
Limitation: If you add a *count* widget to a dashboard, you should not make it filterable, as it may not perform as expected.
{% endhint %}

***

## Troubleshooting: Missing measures <a href="#changethemeasures-troubleshooting-missingmeasures" id="changethemeasures-troubleshooting-missingmeasures"></a>

If you are unable to view specific measures in the grid, it might be due to one of these reasons:

* **You hid the measure**: Check to see if you hid the measure (and have since forgotten you did so). Alternatively, you might have accidentally hidden it when you were formatting it. See the **Hide a measure** section above.
* **Your user restrictions are preventing you from seeing the measure**: Ask your administrator to check your user maintenance settings to ensure that the measure is visible to you. User restrictions override the database default restrictions. Administrators, see [Manage a user's database access and restrictions](https://app.gitbook.com/s/vQCmtGTR7MsjcI62Vdki/users/manage-a-users-database-access-and-restrictions).
* **The default database restrictions are preventing you from seeing the measure**. Ask your administrator to check the database’s default restrictions to ensure that the measure is visible. These restrictions apply to all users unless overridden by the user’s individual restrictions. Administrators, see [Manage default database restrictions](https://app.gitbook.com/s/vQCmtGTR7MsjcI62Vdki/databases-administration#manage-default-database-restrictions).
