> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics

> How to create and use charts and dashboards in OpenOps Analytics

export const NarrowImage = ({src, alt, widthPercent}) => {
  const className = `narrow-image-${useId().replace(/:/g, '-')}`;
  const widthRule = widthPercent ? `width: ${widthPercent}%;` : '';
  return <>
      <style>{`
        .${className} {
          max-width: 75%;
          ${widthRule}
        }
        @media (max-width: 768px) {
          .${className} {
            max-width: 100%;
            width: auto;
          }
        }
      `}</style>

      <img className={className} src={src} alt={alt} />
    </>;
};

You can visualize data that you collect with [OpenOps tables](/reporting-analytics/tables/) and display the visualizations in the **Analytics** view in OpenOps.

In addition to OpenOps tables, OpenOps Analytics can connect to and visualize your existing data sources, such as CSV files, Google Sheets, Postgres databases, and more.

<Note>
  The analytics service is optional. You can disable it by setting `OPS_ANALYTICS_ENABLED` variable to `false` in your `.env` file if you don't need analytics functionality.
</Note>

## Analytics admin portal

To configure data visualizations, click **Analytics** on the main navigation bar in OpenOps. When the **Analytics** view opens, click **Admin Panel** to proceed to the Analytics admin portal that is separate from the main OpenOps application.

To sign in to the Analytics portal, use `admin` as the username and the password defined with the `OPS_ANALYTICS_ADMIN_PASSWORD` variable in the `.env` file in your OpenOps installation folder. (If you haven’t changed the password, the default is `please-change-this-password-1`.)

<Note>
  If you don't have access to the OpenOps installation folder:

  * Contact your OpenOps instance administrator if you're using a self-managed OpenOps instance.
  * [Contact OpenOps support](mailto:support@openops.com) if you're using an OpenOps-hosted instance.
</Note>

Once you log in, you can see a built-in dashboard called **FinOps**. Modifying this dashboard will affect the **Analytics** tab in OpenOps.

<img src="https://mintcdn.com/openops-ecb4f397/S00FeS-kV-AiFG0A/images/analytics-builtin-dashboards.png?fit=max&auto=format&n=S00FeS-kV-AiFG0A&q=85&s=bd34f042b5bc7adc16fc019bac3e5d3a" alt="Built-in dashboards in the analytics portal" width="1935" height="814" data-path="images/analytics-builtin-dashboards.png" />

Behind every OpenOps table, there is a Postgres database view that can be used to build charts and queries.

When a new table is created in [OpenOps tables](/reporting-analytics/tables/), the system automatically creates a new database view with the naming convention *table name \_ table id \_ userfriendly*. You can use this view to create dashboards in OpenOps, as well as connect it to other BI systems.

## Building new charts

To configure a new chart based on an OpenOps table to display in the **Analytics** view in OpenOps, do the following:

1. Navigate to **Datasets** and click **+ Dataset**:
   <img src="https://mintcdn.com/openops-ecb4f397/S00FeS-kV-AiFG0A/images/analytics-create-dataset.png?fit=max&auto=format&n=S00FeS-kV-AiFG0A&q=85&s=30776721a27d719451592a7542c61ebe" alt="Creating a dataset" width="1937" height="637" data-path="images/analytics-create-dataset.png" />
2. Select `openops_tables_connection` for **Database** and `public` for **Schema**. In the **Table** dropdown, select a Postgres DB view corresponding to the OpenOps table you want to source data from. For example, here is what a view may be named for the *Opportunities* table:
   <NarrowImage src="/images/analytics-new-dataset.png" alt="New dataset" />
3. Click **Create dataset and create chart**.
4. In the **Create a new chart** view, select a chart type, then click **Create new chart**:
   <img src="https://mintcdn.com/openops-ecb4f397/S00FeS-kV-AiFG0A/images/analytics-select-chart-type.png?fit=max&auto=format&n=S00FeS-kV-AiFG0A&q=85&s=61f406162ede1dc670934b66d9efe1bf" alt="Selecting a chart type" width="2335" height="1368" data-path="images/analytics-select-chart-type.png" />
5. Configure your chart. Refer to [this Superset documentation page](https://superset.apache.org/docs/using-superset/creating-your-first-dashboard#creating-charts-in-explore-view) if you need help. To preview the configured chart, click **Create chart** in the right pane.
   <img src="https://mintcdn.com/openops-ecb4f397/S00FeS-kV-AiFG0A/images/analytics-chart-preview.png?fit=max&auto=format&n=S00FeS-kV-AiFG0A&q=85&s=c137a632d2c81fa668df9b3c8ce4a220" alt="Chart preview" width="2353" height="1361" data-path="images/analytics-chart-preview.png" />
6. If you make further changes to the chart, click **Update chart** to refresh the preview.
7. When you're done, click **Save**. In the **Save chart** dialog, select **FinOps** in the **Add to dashboard** dropdown:
   <NarrowImage src="/images/analytics-save-chart.png" alt="Saving a chart" />
8. Click **Save**. When you go back to the **Analytics** view in OpenOps, you can see that the chart is now displayed there:
   <img src="https://mintcdn.com/openops-ecb4f397/S00FeS-kV-AiFG0A/images/analytics-chart-in-openops.png?fit=max&auto=format&n=S00FeS-kV-AiFG0A&q=85&s=f86818da246e3fd517e805196b36f6aa" alt="Chart in OpenOps Analytics" width="1510" height="884" data-path="images/analytics-chart-in-openops.png" />

For more information on how to create charts, see the [Superset documentation](https://superset.apache.org/docs/intro/).

## Connecting to external data sources

Here's what you can do to connect OpenOps Analytics to external data sources such as CSV files:

1. In the Analytics admin portal, in the top right corner, click **Settings**, then **Database Connections**.
   <NarrowImage src="/images/analytics-external-menu.png" alt="Database connections settings" widthPercent={40} />
2. Click **+ Database** to connect to an external data source, such as your own Postgres instance or Google Sheets.
3. Once you have created a database connection, if you’d like to upload CSVs to it, click the **Edit** icon for the database connection:
   <img src="https://mintcdn.com/openops-ecb4f397/S00FeS-kV-AiFG0A/images/analytics-edit-db-connection.png?fit=max&auto=format&n=S00FeS-kV-AiFG0A&q=85&s=90ddfb76af0498e55400d6fb9ba448a3" alt="Editing a database connection" width="2256" height="791" data-path="images/analytics-edit-db-connection.png" />
4. In the popup that displays, go to **Advanced > Security**, scroll down, and enable **Allow file uploads to database**.
   <NarrowImage src="/images/analytics-database-allow-file-uploads.png" alt="Allowing file uploads" widthPercent={60} />
5. Click **Finish**.

To upload CSV files into your database, click **+** in the top right corner, then select **Data > Upload CSV to database**:

<NarrowImage src="/images/analytics-upload-csv-to-db.png" alt="Uploading CSV into a database" widthPercent={65} />

You can now build charts based on the data from your external data source, similar to how you do it with OpenOps tables. When you add charts to the **FinOps** dashboard, they become available in the **Analytics** view in OpenOps.

## Support

Feel free to join our [Slack community](https://slack.openops.com) if you have any questions or need help with your installation.
