# source Step Type Properties

Use the `sources` property to add `columns`, `groups`, `filters`, and formulas to a step query.

| Field Name    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `columns`     | The columns for the source. For more information, see [columns Properties](/docs/analytics/bi-dev-guide-json/guide/bi-dbjson-steps-columns.md).                                                                                                                                                                                                                                                                                                                                                                          |
| `groups`      | The dimensions to group the data in the source.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `filters`     | The filters applied to the columns in the source. For more information, see [filters Properties](/docs/analytics/bi-dev-guide-json/guide/bi-dbjson-steps-filters.md)                                                                                                                                                                                                                                                                                                                                                     |
| `name`        | The name of the data source. If the query has formula columns, they’re added as the last source without the `name` property.                                                                                                                                                                                                                                                                                                                                                                                             |
| `cogroupType` | When there are multiple data sources with different `name` properties, this parameter is used to define which records are included in the blended data for this query. Valid values for `cogroupType` are `left`, `right` `inner` `full`. For `left` and `right` blends, the initial dataset or blend is considered the left one. For more information on data blending, see [Explore Multiple Datasets with a Single Query](https://help.salesforce.com/articleView?id=analytics.bi_explorer_data_blending.htm&type=5). |

## Example: Grain Query

```nolang
"sources": [
    {
        "columns": [
          {
            "field": "Customer_Name",
            "name": "Customer_Name"
          },
          {
            "field": "Customer_Segment",
            "name": "Customer_Segment"
          },
          {
            "field": "Product_Name",
            "name": "Product_Name"
          },
          {
            "field": "City",
            "name": "City"
          },
          {
            "field": "Order_ID",
            "name": "Order_ID"
          },
        ],
        "groups": [],
        "filters": [],
        "name": "SuperStoreSales"
    }
]

```

## Example: Query without groupings

When a query isn’t grouped by a dimension, set `groups` to `["all"]`

```nolang
"sources": [
    {
        "columns": [
          {
            "field": ["sum", "Amount"]
            "name": "A"
          },
        ],
        "groups": ["all"],
        "filters": [],
        "name": "SuperStoreSales"
    }
]

```

## Example: Query with groupings

```nolang
"sources": [
    {
        "columns": [
          {
            "field": ["sum", "Amount"]
            "name": "A"
          },
        ],
        "groups": ["Customer_Segment", "Order_priority"],
        "filters": [],
        "name": "SuperStoreSales"
    }
]

```

## Example: Query with formula column

```nolang
"sources": [
    {
        "columns": [
          {
            "field": ["sum", "Amount"]
            "name": "A"
          },
          {
            "formula": "case \nwhen starts_with('Product_Container', \"Small|") then null\nelse count()\nend\n",
            "name": "B"
          }
        ],
        "filters": [],
        "groups": [
            "Order_Priority",
            "Product_Container"
        ],
        "name": "SuperStoreSales"
    }
]

```

## Example: Query with columns referencing formulas

Formula columns are defined in a separate source without a `name` property.

```nolang
"sources": [
    {
        "columns": [
          {
            "field": ["sum", "Amount"]
            "name": "A"
          }
        ],
        "groups": ["Customer_Segment", "Order_Priority"],
        "filters": [],
        "name": "SuperStoreSales"
    },
    {
        "columns": [
          {
            "forumula": "A*2",
            "name": "B"
          },
          {
            "forumula": "B/100",",
            "name": "C"
           }
         ]
    }
]

```

## Example: Query with multiple data sources

```nolang
"sources": [
    {
        "columns": [
          {
            "field": ["avg", "Profit"]
            "name": "A"
          }
        ],
        "groups": ["City"],
        "filters": [],
        "name": "SuperStoreSales",
        "cogroupType": "left"
    },
    {
        "columns": [
          {
            "field": ["sum", "Amount"],
            "name": "B"
          }
        ],
        "groups": ["City"],
        "filters": [],
        "name": "Opportunity"
    }
]

```
