Q interpretation of NULL date values

Hi, we have Amazon Q for QuickSight embedded in our application to provide Q&A for our users.

In our database, NULL values in date fields are represented as “Dec 31 2499”. Q doesn’t know how to interpret this NULL date value, however, and logically considers this as regular date alongside other non-NULL date values.

As an example, we have a table containing project level information, where a Project Completion Date of “Dec-31-2499” implies the project is still in progress. When asking a question via Q that refers to project completion - e.g. “in which year were the most projects completed”, Q logically answers as though Dec-31-2499 is an actual date value rather than a NULL placeholder.

Is there a way we can define NULL value representations used in our database so Q is aware to handle these as such?

Hi @iparnell,
What if you setup a calculated field to use instead for that field:

ifelse({date_field} = 'Dec 31 2499', 'null', 
{date_field})

Then turn off the old date field and use this calculated field in its’ place instead.

An alternate approach you could try, setup a filter in your topic to filter out any fields where the date = Dec 31 2499 if you don’t want to include that data in your calculations.

Let me know if one of these approaches works for your case or if you have any additional questions.

Hi Brett, thanks for your reply.

There may be questions asked of the same topic where we do want the rows with a NULL value date field to be considered so I don’t think a filter would work for us.

Replacing the original field in the topic with a calculated field may be an option. Do you know how Q would interpret date fields with a NULL or empty value? Would Q just ignore the corresponding rows depending on the question being asked?

Hi @iparnell,
Off the top of my head, I’m not completely sure how the nulls would be handled in your situation, sometimes Q picks up on certain parts of the question and reacts differently depending on your available fields.

One other work around option that would be more specific to the question (which sometimes just becomes time consuming) but you can create an additional calculated field that Q will pick up on to include in your answer.

Name it something like ‘Project Completion Date’

ifelse({date_field} = 'Dec 31 2499', 'Open', 
'Closed')

That way, when asking about closed projects, it should incorporate this additional field to help sort out which fields are still ‘open’.

Let me know if that helps as well!