Calculate a field in Map Viewer

Publish the data

Your first task is to map the data your colleague shared. You can only calculate fields for data you own, so you'll publish it as a layer to your account.

  1. Open the Retail Store Revenue page.

    This data is in the form of a file geodatabase, which is a compressed format for sharing geographic data. You'll download a copy and publish it so you can view it on a map.

  2. Click Download.

    Download button

    The Retail_Store_Revenue.zip folder is downloaded to your computer. Don't unzip it. To use a file geodatabase in ArcGIS Online, you must upload a zipped copy of the .gdb file.

  3. Sign in to your ArcGIS organizational account.
    Note:

    If you don't have an organizational account, see options for software access.

  4. On the ribbon, click the Content tab. Click the New item button.

    New item button on the My content page

  5. Drag the Retail_Store_Revenue.zip file you downloaded to the New item window.

    New item window drop zone

  6. For File type, choose File geodatabase.

    File geodatabase option

  7. For How would you like to add this file, ensure that Add Retail_Store_Revenue.zip and create a hosted feature layer is selected.

    This option will create two items in your ArcGIS Online account. One will be a copy of the file geodatabase. The other will be a feature layer created from the contents of the file geodatabase.

  8. Click Next.
  9. For Title, type Retail Store Revenue, followed by your name or initials (for example, Retail Store Revenue YN).
    Note:

    You cannot create two layers in an ArcGIS organization with the same name. Adding your initials to a layer name ensures that other people in your organization can also complete this tutorial. Once a layer has been created, you can rename it in the map to remove your initials, which will not affect the name of the underlying data layer.

  10. For Summary, type Retail store locations with revenue data for 2023-2025.

    These details can be modified later.

    New item window details

  11. Click Save.

    The item page for the new feature layer appears. The item name is Retail Store Revenue YN and the item type is Feature layer (hosted).

  12. On the item page, click Open in Map Viewer.

    Open in Map Viewer button

    The file your colleague sent is now visible on the map, with each store location displayed as an individual point.

Map the sales

Now that you've published the sales data as a layer and opened it in Map Viewer, you'll explore and visualize it on the map. Each store location point has data stored with it that can help you assess how that location is performing in terms of revenue. You'll use pop-ups to explore the data fields and then map the store locations according to average annual sales.

  1. On the map, click one of the store location points.

    Pop-up for a store location

    An informational pop-up appears, listing the data associated with that store location. Each store has sales data for the years 2023-2025, average annual sales, and operating expenses. You'll start by mapping the average sales for each branch.

  2. If necessary, in the Contents pane, click the Retail Store Revenue layer to select it.

    Selected layers are highlighted by a blue bar.

  3. On the Settings (light) toolbar, click Styles.

    Styles button on the Settings toolbar

    The map is currently styled to show just the location of each store.

  4. Under Choose attributes, click Field.

    Field button

    Now you can see all the fields currently in the dataset. Sales data for the years 2023-2025 is recorded in the layer, as well as average annual sales and percent growth. To compare locations and look for possible patterns related to the location of these stores, you'll start by mapping the average annual sales.

  5. In the Select fields window, select the Average sales field and click Add.

    Select fields window

    The map updates to show the store locations styled by their average annual sales. The larger the point, the higher the average revenue.

  6. In the Styles pane, click Done.

    Average sales map

    From this map, you can see that the store locations in the south have the highest average sales. The stores in the northwest have the lowest average sales.

Add a new field

Looking at the fields in the Retail Store Revenue layer, you noticed that the layer is missing a key metric that you want to evaluate: net operating income (NOI). NOI is the difference between sales revenue and operating expenses. This metric can help you understand the profitability of a location, which is important information for you and your colleagues to have on hand. To calculate NOI and save it to your layer so that it can be used across your organization, you'll add a new field to the layer.

Note:

NOI can also be generated for both styling and pop-ups using ArcGIS Arcade, but this method is more temporary. Arcade expressions can be saved to the layer and used in other maps, but they are only available when styling a layer or configuring pop-ups.

Adding a new field and calculating it is a better way to ensure the attribute value is permanently written to the feature layer and becomes part of the system of record if, for example, you plan to export this later.

You'll start by adding a new field to calculate. You can also perform calculations directly on existing fields, but this isn't recommended, as it will permanently change your data.

  1. On the Settings toolbar, click Fields.

    Fields button on the Settings toolbar

  2. At the bottom of the pane, click Add field.

    Add field button

    The Add field window appears.

  3. For Select the data type that will be stored in the field, choose Numbers.

    There are several types of numeric data you can choose from. Because you're calculating a number expressed in units of dollars, you'll choose Double so that you can store decimal values.

  4. Choose Double and click Next.

    Add field window

  5. For Field name, type Net_Operating_Income.

    The field name is stored in the database and can't have any spaces in the name. To provide a more human-readable name, you'll also give the field a display name.

  6. For Display name, type 2025 Net Operating Income (NOI).
  7. For Field description, type 2025 Net Operating Income for Virginia store locations. Values expressed in USD ($).

    Add field window details

  8. Click Add field.

    A new, empty field is added to the layer.

  9. In the Layers pane, for the Retail Store Revenue layer, click Options and choose Show table.

    Show table option

  10. Scroll through the table until you see the new 2025 Net Operating Income (NOI) field.

    Blank field in the attribute table

    Unlike the other fields in the table, this one is empty. Now that the field has been created, you can calculate values for it.

Calculate a field

Now that you've created the empty field, you can calculate the NOI metric. NOI is the difference between sales revenue and operating expenses. Based on the fields in this layer, it can be calculated using the formula 2025 Revenue - (Operating Expenses + Property Taxes). You'll use the Calculate field window to write and test this expression before adding the calculated values to the field.

  1. For the 2025 Net Operating Income (NOI) field, click Menu and choose Calculate field.

    Calculate field option in the attribute table

    The Calculate Field window appears. The first choice is which language you want to use to build your calculation: Arcade or SQL. This tutorial will show the calculation in Arcade, but both options will work for your needs. Arcade is a scripting language created by Esri, and it has a few functions that aren't available in SQL. For more information, see the Arcade documentation.

  2. For  Select language, choose Arcade. If necessary, click Next.

    Choose Arcade.

    The next option allows you to filter the features to include in the calculation. This is useful in cases in which you want to calculate a specific subset of data—for example, only locations in the state of Texas.

    You want to run the calculation for each store location, so you'll skip this step.

  3. Click Next.

    Now you're ready to build your calculation. NOI is calculated as sales revenue minus operating expenses. From your visualization earlier, you know that sales revenue is in the field 2025 Revenue. Operating expenses are in two fields: Property taxes and Operating expenses.

  4. In the Arcade expression pane, in the action bar, click Profile variables. Click the arrow for $feature.

    $feature arrow

    This tab offers a list of predefined variables, including attribute fields and geometry for the layer features. The $feature panel shows the list of attributes included in the layer. These can be added to the expression.

  5. In the Profile variables panel, click $feature.F2025_Revenue.

    $feature.F2025_Revenue field

    The variable is added to the expression window.

  6. In the expression window, after $feature.F2025_Revenue____, type a space, minus sign, and an open parenthesis.
  7. Make sure your cursor is placed inside the parenthesis. In the Profile variables panel, click $feature.PropertyTaxes and $feature.OperatingExpenses.
  8. In the expression window, place your cursor between the two variables and add a space and a plus sign.

    Completed Arcade expression

    The expression reads $feature.F2025_Revenue____ - ($feature.Net_Operating_Income + $feature.OperatingExpenses)

    Now that the expression is written, you'll test it to ensure that it calculates correctly.

  9. In the expression window, click Run.

    Run button

    The Output tab appears with a numeric result. Once you've created your expression, you can use the Run button to test the output of your expression and review it here.

    Since the expression successfully evaluates, you'll run the calculation. You can also verify the expression in the table.

  10. In the Test features table, ensure Auto preview is enabled. Review the Errors column to ensure there are no errors.

    Test features table

  11. Click Run calculation.
  12. In the Calculations complete window, click Close.
  13. Locate the  2025 Net Operating Income (NOI) field in the attribute table and ensure that it has been calculated for all store locations.

    Calculated NOI field

  14. Close the table.

    Now that you've calculated the new NOI field, it can be used for styling the data and in the informational pop-up.

  15. On the Settings toolbar, click Styles. For Choose attribute, click Average sales and choose 2025 Net Operating Income (NOI).

    NOI map

    The map redraws to show the newly calculated field. You can use the NOI metric to understand how stores are earning compared to their operating costs. For example, based on this metric, the store in Arlington (to the northeast) is performing better than the Alexandria (southern) stores, though these branches had higher average sales.

    Finally, you'll save your map.

  16. On the Contents (dark) toolbar, click Save and open and choose Save as.

    Save as button on the Save and open menu

  17. Title the map Retail Store Revenue and NOI and click Save.

    The NOI metric is now saved to your layer, and you can share the map with your colleagues to evaluate regional patterns in store revenue.

In this tutorial, you calculated a field in Map Viewer. First, you published and mapped the data. Then, you added a field. Lastly, you used Arcade to create an expression and calculated the field.

You can find more tutorials in the tutorial gallery.