How to Compare Values of Two Specific Dates Using Dashboard Parameters in Bold BI
Published:
This setup lets you select two individual dates (not a date range), show each date’s value, and calculate a comparison metric (for example, Value1 / Value2). It’s useful when the Period Over Period widget does not meet your single-date comparison requirements.
Solution Overview
- This approach uses:
- Two data sources
- Dashboard parameters
- Code View mode
- Independent Date Pickers
- This avoids master-filter conflicts and ensures accurate value comparison.
Configuration Steps
Step 1: Add the Base Data Source to the Dashboard
- Open the Bold BI Dashboard Designer.
- Add the data source that contains the date and value fields required for comparison.
- Preview the data to confirm that the date column is correctly identified and that records are available for multiple dates.
Step 2: Create a “Date list” Data Source for Date Selection (only available dates)
Configure the Date Data Source
- Add a new data source using the same database connection.
- Select your SQL connector, then switch to Query mode.
- Use a query that returns only distinct available dates:
Sample SQL:
SELECT DISTINCT MadadDate
FROM MadadValues
- Preview the data to confirm that only the date column is returned.
Create Dashboard Parameters for the two dates
- In the second data source, navigate to the parameters section in the data design view
- Create the following parameters:
- Date_1 (Data type: Date)
- Date_2 (Data type: Date)
- Ensure that both parameters allow only a single value.
These parameters will be used to control the selected dates in the dashboard.
Step 3: Add Date Picker Widgets
-
Add two Date Picker widgets to the dashboard.
-
Configure the first Date Picker:
- Bind it to the Date_1 parameter
- Enable Highlight Available Dates
-
Configure the second Date Picker:
- Bind it to the Date_2 parameter
- Enable Highlight Available Dates
Verify Behavior
-
Open each Date Picker and confirm:
- Only available dates from the dataset are selectable
- Missing dates cannot be selected
Important:
Remove any column binding from the Date Picker before binding a parameter.
Then use Add Expression (fx) to bind the Date Picker to a dashboard parameter.
Step 4: Create a Calculation Data Source
- Add a new data source and switch to Code View.
- Use a query similar to the following (adjust table/column names as needed):
Sample Query:
SELECT
MAX(CASE WHEN MadadDate = @{{:Date_1}} THEN MadadValue END) AS Value1,
MAX(CASE WHEN MadadDate = @{{:Date_2}} THEN MadadValue END) AS Value2,
MAX(CASE WHEN MadadDate = @{{:Date_1}} THEN MadadValue END) /
NULLIF(MAX(CASE WHEN MadadDate = @Date_2 THEN MadadValue END), 0) AS Ratio
FROM MadadValues
Verify Output
- Preview the data source and confirm that:
Value1returns the metric forDate_1Value2returns the metric forDate_2Ratiocalculates correctly and does not fail whenValue2 = 0
Step 5: Add Value Widgets to display Value1, Value2, and Ratio
- Add three Number Card widgets.*
- Bind them to the calculation data source fields:
| Widget | Field |
|---|---|
| Card 1 | Value1 |
| Card 2 | Value 2 |
| Card 3 | Ratio |
Verify Behavior
- Changing either Date Picker updates the cards’ values
- Ratio updates correctly
- The date selection does not cause unwanted cross-filtering between widgets
Conclusion
Using:
- Dashboard parameters
- Separate data sources
- Code View queries
You can reliably compare values from two specific dates in Bold BI without relying on range-based widgets.