Dynamic Time Series analysis using Chart widget in Bold BI
This article explains how to dynamically switch values in a chart based on a combo box selection using dashboard parameters and expressions concepts in Bold BI®.
Use Case:
In this use case, we will show the Sales data with different time periods: Yearly, Monthly, and Daily. You can modify these values to fit your specific needs. The user will be able to select from these time periods through a combo box, allowing for dynamic changes in the data visualized on the dashboard.
Step-by-Step Guide to Dynamic Chart Configuration in Bold BI®:
Step 1: Create a Parameter in Bold BI
- Navigate to the Data Source Designer page of your dashboard and locate the Dashboard Parameters section.
- Create a String Type parameter and select the mode as List.
- Add values manually: Yearly, Monthly and Daily
Note: When using the List Mode, set the Default value when using the dashboard parameter in the same data source.
Step 2: Add the Parameter to the Combo Box
- Drag and drop a Combo Box widget onto your dashboard
- Configure the created dashboard parameter in the Combo Box widget.
Step 3: Create Expression to Format Created Date for the Chart
Columns Expression:
This below expression dynamically formats the CreatedDate based on the selected parameter value, returning the year for ‘Yearly’, the month and year for ‘Monthly’, and the full date as a string for ‘Daily’.
CASE
WHEN @{{:Parameter1}} = 'Yearly' THEN CAST(YEAR([CreatedDate]) AS VARCHAR)
WHEN @{{:Parameter1}} = 'Monthly' THEN FORMAT([CreatedDate], 'MMM yyyy')
WHEN @{{:Parameter1}} = 'Daily' THEN CAST([CreatedDate] AS VARCHAR)
END
Note: Replace @{{:Parameter1}}
with the parameter you created.
Step 4: Bind the Expressions to the Chart
- Drag and drop a Chart Widget.
- Use the SalesDetails for the Y-axis.
- Use the Columns expression(Time Series Analysis) for the X-axis.
Step 5: Preview to Time Series Analysis Data:
- Change the value in the Combo Box.
- The chart should update dynamically based on the selected time period (Yearly, Monthly and Daily).
By following this guide, you can easily configure a dynamic chart in Bold BI® that updates based on a user’s selection from a Combo Box. This approach allows you to display sales data in various time periods (Yearly, Monthly, and Daily), giving users a flexible and interactive way to analyze trends and make data-driven decisions.