A Quick Guide to AI-Powered Data Visualization: Create a Smart Dashboard with LogicLoop.
Tags: beginners, tutorial, sql, analytics
Published: 2023-05-12 14:30:36


### INTRODUCTION

LogicLoop is a cloud-based platform that lets you connect to your data source, supercharge your data to perform automations, and design dashboard layouts with just a few clicks. LogicLoop is essentially a no-code tool, as it doesn't require any technical skills or prior experience. However, users need to possess the ability to ask the right questions in order to obtain their desired results.

AI tools and platforms such as LogicLoop enable data analysts to improve productivity and provide data-driven solutions to stakeholders. LogicLoop helps to simplify the process of analyzing, troubleshooting, and creating visually appealing dashboards. Rather than spending hours on focused work, data analysts can leverage the power of these tools to speed up their tasks.

In this article, you will learn how to build a simple sales dashboard using LogicLoop's sales sample dataset. By the end of this article, you will be able to create impressive projects in just a few minutes. Are you curious and excited? So am I! Let's dive in.



### SETTING UP AN ACCOUNT

- Navigate to the [set up](https://app.logicloop.com/setup) page and follow the instructions on the page to create an admin user account.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/meigxoodsx8nxznzqve5.png)
- To activate your account, follow the verification link sent to your email. Then you can sign in.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tb0ytodhwjhswce7xz8.png)
- Enter your company name when prompted, and provide all the required details to access the dashboard page as show in the image below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qlus7c0zdpbnplb1xvof.png)

### CONNECTING TO A DATA SOURCE

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f8rimgyxynzafg23d2rm.png)

With LogicLoop, users have the ability to connect to more than 40 different data sources. Detailed information regarding the process of connecting to each data source can be found on the [documentation page](https://docs.logicloop.com/). However, for the purpose of this tutorial, the sales sample dataset will be used, and thus, there will be no need to connect to any external data source. To get started, please follow the steps below:

- Click on the `Rules` tab located on the sidebar. You will be redirected to the rules page. The rules feature allows you to create SQL code to extract data from your datasets. Once written, these rules are saved and can be utilized repeatedly.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xogwz6xmshfnulgh5mm8.png)
- Click `New Rule Query` on the right side of the page. You’ll go to the rules page, which shows the following sections:
    - The left sidebar lists the tables in the `Sample Postgres DB `dataset.
   - The main section has a text editor where you can enter your SQL queries. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nzhgtjpmzzztgtr481fo.png)
This rules feature lets you create SQL code to extract data from your datasets. You can save these rules and use them repeatedly.

- Click the `AI query helper` menu and select the `query generator` option. This opens the form for generating queries.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hurof4ivh6lny98jo31x.png)
In the text field, type this prompt:

>  Write a query that selects the top 10 companies with the highest total transaction amount, then selects the product quantity and the total number of orders for each company.
From the dropdown field, choose these tables: `Customers`, `product_orders`, and `transactions`.

 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4eeyaeeztn6v61qymeq.png)
- Click on the `Generate` button to submit your prompt. If all goes well, your output should look like the image below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kz5k0rwohoxyllgwfdu8.png)

- Copy the output code, paste it in the text editor, and click on the `View results` button to show your results. If the result obtained is satisfactory
- Click on the `Save Results` button to persist your data.
- Then, click on the `Add Visualization` tab beside the results table to create a new visualization for your data. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dx6eg722d8hhyxkwxpph.png)
- Change the visualization name to `Amount spent per company`. Choose `company_name` for the `X-column` and `Total amount` for the `Y-column`.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ek9layuurmyfmajxaeo.png)
- To make more room for the long label names that are angled diagonally, choose the horizontal bar option. This arranges the bars horizontally.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bxzfc9oh2w8am76jo5hi.png)
- Navigate to the X-axis tab and deselect the `sort values ` option to arrange the chart in ascending order. 
To change the color of your chart, follow these steps:
   - Go to the colors tab.
   - Click the icon beside the `automatic` text.
   - In the HEX code field, type `#E1CFEC`.
   - Save your visualization.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tg1d8z8u8c0dodeuq2l3.png)

Voila! You’ve made and customized your first chart on LogicLoop. Next, you’ll create a dashboard and add your chart to it.

### CREATING A DASHBOARD

In this section, you will use LogicLoop Platform's drag-and-drop interface to create a dashboard layout with different components, such as charts, tables, and other widgets. LogicLoop offers a wide range of visualization options, such as bar charts, line charts, pie charts, maps, and more. You can also add text boxes and images to enhance your dashboard. To get started:

- Click on the `Dashboards` tab on the left sidebar. You will be redirected to the dashboard page.
- Click the `New Dashboard` button at the top of the page and enter the name of your dashboard.

- Click on the `Add Textbox` button, a modal will appear. 
- Enter the title of your dashboard. After saving your text, a card will appear on your dashboard. 
- Drag and drop the card to your desired location.
- Next, click on the `Add Widget` button, another modal will appear.
- Select the name of your rule and choose the `Chart` option. Your chart should appear on the dashboard as shown in the image below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ksq9xokttm41gphtjqgu.png)
- Add another widget, this time, select the table option and align it next to the bar chart.
- Navigate to the rules page to create a new rule for a time series area chart. 
- To get the top 10 order quantities by date, type this SQL query in the editor and save your code:

```sql
SELECT
  CAST(EXTRACT(YEAR FROM transactions.created_at) AS VARCHAR) || '-' || CAST(EXTRACT(MONTH FROM transactions.created_at) AS VARCHAR) AS Month_Year,
  SUM(transactions.amount_us_dollars) as total_transactions,
  SUM(product_orders.quantity) as order_quantities,
  COUNT(product_orders.order_id) AS total_number_of_orders
FROM
  customers
  LEFT JOIN transactions ON customers.customer_id = transactions.merchant_id
  LEFT JOIN product_orders ON customers.customer_id = product_orders.customer_id
GROUP BY
  Month_Year
ORDER BY total_number_of_orders DESC
LIMIT 100

```
- To create an area chart, follow these steps:
  - Click Add Visualization.
  - Choose `Area` as the chart type.
  - For the `X-column`, choose `month_year`.
  - For the `Y-column`, choose `total_number_of_orders`.
Your chart might look strange, as shown in the image below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/whdl6bqz5yr79ij47nlw.png)
- To correct this, go to the `X-axis` tab and change the scale from `Auto-detect` to `Datetime`. 

- To match the dashboard theme, change the chart color to #E1CFEC. Your chart should look like the image below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jq8dsxeq5ucyzue66o6r.png)
- After you save the chart, click the three vertical dots next to `Edit visualization.`

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a4zygzp8f104ydk7c1a0.png)
- Select the `Add to dashboard` option to add your new chart to the dashboard.
- Navigate to the dashboard page and you should see the new chart. 
- To adjust your chart size, drag the bottom right corner of the chart. You can make it bigger or smaller as you like.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/us9vcj3s22cbtbdbulju.png)
Congratulations! You have successfully created your first AI assisted dashboard on LogicLoop. 

### CONCLUSION

You have just witnessed the power and simplicity of the LogicLoop platform, a tool that lets you harness the potential of your data with AI assistance. No coding skills are required to create stunning and insightful applications that can boost your productivity and creativity. With the LogicLoop platform, you can explore the infinite possibilities of what you can achieve with data and AI. I hope you continue to explore the use cases for LogicLoop and go on to build amazing things.