- Newest
- Most votes
- Most comments
Hello and good morning,
The issue you're encountering in Amazon QuickSight with the computed field not properly adjusting date ranges based on the TimeZone parameter appears to be related to how QuickSight handles date filtering and time zone conversions. This is not necessarily a bug, but rather a limitation in how QuickSight interprets relative date filters and time zone offsets.
To work around this issue, you can approach the problem with a different strategy:
**1. Adjust Date Range Calculation: **Instead of relying solely on QuickSight's relative date filters, consider adjusting your computed field formula to directly calculate the date range based on the selected TimeZone parameter. For example, if you're trying to get the "Last 4 hours" in the user's local time zone (based on the selected TimeZone), you can calculate the start and end timestamps accordingly.Example formula for calculating the start and end timestamps for "Last 4 hours":
sql
addDateTime(${TimeZone}, 'HH', epochDate(currentDatetime()) - 4*3600) as StartTime, addDateTime(${TimeZone}, 'HH', epochDate(currentDatetime())) as EndTime
Here, currentDatetime() provides the current UTC timestamp, and addDateTime() adjusts it based on the selected TimeZone. Adjust the - 4*3600 (which is 4 hours in seconds) based on your specific needs.
**2. Apply Custom Date Filters: **2. Instead of relying solely on QuickSight's built-in relative date filters, use custom date filters based on the calculated StartTime and EndTime fields. Create a filter in QuickSight using these fields to filter your data based on the desired time range in the user's local time zone.
**3. Testing and Validation:**After implementing the adjusted approach, thoroughly test your dashboard to ensure that the date ranges are correctly calculated and applied based on the selected TimeZone. Check different time zones and relative date ranges to validate the behavior across different scenarios.
By implementing these adjustments, you'll have more control over how date ranges are calculated and applied within your Amazon QuickSight dashboard, ensuring that users see the data in their local time zone as intended. While QuickSight's native date handling might have limitations in this area, custom calculations and filters can often provide a robust workaround for specific use cases like this.
Ismael Murillo
Relevant content
- asked 10 days ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago