Articles in this section
Category / Section

How to Create a New Date Column Using Day, Month and Year Columns in Bold BI

Published:

In Bold BI, you can create a new date column using existing day month and year columns. This can be achieved by using the to_timestamp function and the CONCAT function.

Here is the step-by-step guide:

  1. Open the data source where you want to create the new date column.
  2. Click on the ‘Add’ button to add a new expression.
  3. In the ‘Expression Name’ field, give it a name, like DayMonthYear.
  4. In the ‘Expression’ field, enter the following formula:
to_timestamp(CONCAT(cast([Year] as varchar(4)),'-',[Month],'-',[Day], ' 00:00:00'),'YYYY-Mon-dd')

image.png

This formula concatenates the year and month columns, along with a fixed day and time, to create a timestamp. The cast function is used to convert the year column to a string, and the to_timestamp function is used to convert the resulting string to a timestamp.

  1. Click ‘Save’ to save the new expression.
    image.png

Now, you have successfully created a new date column using the month and year columns.

Bold BI supports various data sources for the to_timestamp function such as:

  1. MySQL
  2. PostgreSQL
  3. Oracle Database
  4. Microsoft Azure SQL Database
  5. Amazon RDS
  6. Google BigQuery
  7. Snowflake
  8. SQLite
  9. Microsoft Access.

Note: The availability of the to_timestamp function may depend on the specific syntax and functions supported by each database system.

For SQL server, please utilize the expression mentioned below as it does not support the to_timestamp function.

CONVERT(DATE, CAST([Year] AS VARCHAR(4)) + '-' + [Month] + '-' + [Day])

Additional References

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
RM
Written by Reethika Moovendhan
Updated
Comments (0)
Please  to leave a comment
Access denied
Access denied