Category / Section
How to filter data based on Relative Date in Bold BI
Published:
In Bold BI, at present, there is no direct support for filtering data based on relative date in the initial filter. However, you can achieve this by using the code view mode in your data source. This article will guide you through the process of filtering data based on a relative date, such as the last six months.
Steps to filter data based on Relative Date
- Create or edit a data source that has date field. Drag and drop the table you want to filter in your data source.
- Enable code view mode by clicking on the “Code View” button.
- Use the following query syntax to filter the data based on the desired relative date:
Where [DateColumn] <= GETDATE() and [DateColumn] >= DATEADD(month, -6, CAST(GETDATE() AS DATE));
Replace [DateColumn]
with the name of the date column in your table, and -6
with the number of months you want to filter. You can also replace GETDATE()
with a specific date if you want to filter based on specific dates.
Here’s an example of how the query should look like:
SELECT <Columns> FROM <Table>
WHERE OrderDate <= GETDATE() and OrderDate >= DATEADD(month, -6, CAST(GETDATE() AS DATE));
This query will filter out data for the last six months.
Related Articles: