---
title: "Data Source for the Weekday Widget"
url: "https://docs.ops.center/en/article/data-source-for-the-weekday-widget"
language: "en"
last_updated: "2025-03-24T16:05:36.249Z"
---

# Data Source for the Weekday Widget

**Topics Covered**

-   Adding and configuring a new data source for the Weekday Overview widget.
-   Selecting and aliasing tables and columns to structure normalized data.
-   Defining relationships and parameters in the query to filter data by board ID.
-   Applying query filters to restrict data to the current board.
-   Finalizing the data source and adding it to the dashboard.
-   Preparing the dashboard for widget creation by saving changes and revealing the designer.

### **Create a new widget**

In this section, we will create a new widget to display an overview of the weekdays and how many cards are created on each weekday. Additionally, we will use the first widget (the List Box) as a filter for this new widget.

**Step 1.** Open the main menu

Click on the **Main Menu** button to open it and navigate **to Data Sources**

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/yTDnynwjSBEjtTHO.gif)

**Step 2.** Add a data source

Click add **New Data Source** and Choose **Database** and then click **Next** to proceed.

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/YbcO6IWqjtDlR7jY.gif)

**Step 3.** Select the WarehouseConnetion

And name the query CardsperDay. Next, click on the Run Query Builder... to continue.

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/2B62UPsMc3_WAlMk.png)

### **Add Tables for Weekday Analysis**

To set up the data for grouping cards by weekday, we'll add several key tables to the query builder. Here's how to proceed:

**1\. Add the Cards Table**

-   Search for **dimWorkItems** in the **Available Tables and Views** section.
-   Double-click on oc.dimWorkItems to include it in the query. This table contains the card data needed for the analysis.

**2\. Add the Categories Table**

-   Search for **dimWorkItemCategories**.
-   Double-click on oc.dimWorkItemCategories to include it. This is required for the master filter functionality.

**3\. Add the Dates Table**

-   Search for **dimDates**.
-   Double-click on oc.dimDates to include it. This table provides the full date data, which is essential for grouping cards by weekdays.

  
 

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/2j1RNzA4m7rcIMQ-.gif)

**💡 Note on UTC Weekdays**  
The date used for this widget is in UTC, so the grouping will reflect UTC weekdays. This may result in a slight shift when compared to localized time zones. For the purpose of this tutorial, we will use UTC, and instructions for handling localized times will be covered later in the course.

This setup utilizes normalized data:

-   **dimWorkItems (Cards)**: Stores card data.
-   **dimWorkItemCategories**: Ensures compatibility with the master filter.
-   **dimDates**: Provides the complete date information.

With these tables added, we can move forward to configure the query for our widget.

### **Adjust Relationships**

When normalizing data for the dashboard, it is crucial to ensure that the relationships between tables are accurate. By default, connections between tables are auto-generated based on references. However, there might be cases where the generated connections are incorrect, especially when the same table (e.g., dimDates) is referenced multiple times in another table (e.g., oc.DimWorkItems).

To fix this, we need to remove incorrect relationships so that the correct ones can be established later.

**1\. Steps to Adjust Relationships**

-   **Select and Remove Incorrect Connections**
-   Locate the **dimDates** table in the query builder.
-   Click on the join **line** connecting dimDates to another table (e.g., oc.DimWorkItems).
-   Click on the **Trashcan** button to delete the relationship.  
    ![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/VC50NPOXx1wpMPpQ.gif)

### **Assign Aliases, Select Columns, and Add a Parameter**

To properly structure and filter your data source, we'll follow these steps to assign aliases to the tables and columns, select only the necessary data, establish relationships, and add a parameter. This will prepare the data source for accurate and efficient widget functionality.

1\. **Assign Table and Column Aliases:** Select the dimWorkItems table by clicking its header:

-   Set the **Alias** to Cards.
-   Check the **ID** column and assign it the alias CardID.
-   Check the **BoardID** column and assign it the alias BoardID.

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/vEK6cjTy3UTF7js_.gif)

**2\. Click on the header of the dimWorkItemCategories table**

-   Set the **Alias** to Categories.
-   Check the **ID** column and assign it the alias CategoryID.
-   Check the **Title** column and assign it the alias CategoryTitle.

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/4iQn_XiQ0XFJq-tf.jpg)

3\. **Click on the header of the dimDates table**

-   Set the **Alias** to Dates.
-   Click the **ID** column, and drag it to the **CreatedOnDateId** column of the Cards table to establish a relationship.

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/Tvehz04lA5u2t2WI.gif)

**4\. Final steps**

-   Check the **Date** column and assign it the alias Date.
-   Set the **Sort Type** to Ascending in the Column Properties section.

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/OVcwfb6gkj7cUj28.jpg)

### **Add a Parameter**

-   Expand the **Parameters** section on the side-panel and click the **plus button** to add a new parameter.
-   Expand the new parameter to view its properties:
-   Set the **Name** to BoardId.
-   Set the **Type** to Expression.
-   Set the **Result Type** to Number (32 bit integer).
-   Set the **Value** to ?BoardId (Use the three-dot menu to open the popup, then **double-click the Board ID** to select it.).  
     

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/hMYUMSaFYYmh2egE.gif)

**💡 Key Notes**

**Normalization Insight**: By setting column aliases and filtering data, we simplify referencing these columns later and maintain consistency.

**Parameter Functionality**: The BoardId parameter links this data source to the dashboard filters, ensuring the data shown is specific to the selected board.

### **Filtering Data Source for Specific Board**

To ensure the data source only contains information relevant to the current board, we filter the query using the BoardId parameter. This ties the data directly to the user’s selected board, keeping the dashboard focused and efficient.

Open the **Query Properties** section in the side-panel and click the 3 dots next to the **Filter** field to access the Filter Editor. In the Filter Editor, hover over the **And** operator, click the **plus** icon, and add two conditions: Use the **BoardId** parameter to filter records and define any additional criteria if necessary. Click **OK** to save and exit the Filter Editor.

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/lvly66AFE6Kd4ym6.gif)

Click **OK** again to close the Query Builder and finalize the data source setup.

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/SyMQsEPS4dLzg3EG.png)

### **Finalizing and Adding the Categories Query**

In this section, we finalize the newly created query and integrate it into the dashboard, making it available for use in widgets. Steps to Finalize and Add the Query

**Step 1.** Close the Data Source Wizard

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/zXNayKb2ECEl1plN.jpg)

**Step 2.** Add the Query to the Dashboard:

Click **Add** to include the new query in the dashboard.

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/qpnX9SRCxfuM27Gi.jpg)

**3\. Save Your Changes**

![](https://articulateusercontent.com/rise/courses/anJhCl1pHa1oo6fKgeB1RWMvBMfXIlUx/eEE82Pbd4p8UsSvl.jpg)
