As a Qlik app creator, you have more control about how well Insight Advisor can answer user questions than you may think. Before the first question is even asked, Qlik looks for cues within an app to know how best to answer it. Let’s explore how you can help Qlik’s Insight Advisor get off to a better start and gain user trust faster.

Default generic date

Using Qlik’s Insight Advisor, you can ask “What are sales for this year?” or request past sales with a statement like “Sales in 2016.” If your data model has several date fields, Qlik will return results based on Qlik’s best guess of what date field it should filter to give the best answer. Unfortunately, in a new app it has little context to decide what field is the best option. You may get lucky, but most often it will likely choose the wrong field. In the following example, we likely would want to view sales by a transaction date, but Qlik used delivery date instead.

Logical Model

So, how does Qlik choose which date field to use? Your first thought may be to use some option within the logical model because this is what Qlik created to help developers guide Insight Advisor to provide better answers to users. Of the options in the Logical Model, the Fields and Groups section does has 2 options to either hide a field or disable it from being used as a filter. Surprisingly, neither of these options work. With the following settings, we continue to get the same results and see sales by delivery date.

Additionally, setting up a calendar period using another date field and then creating a behavior for the “Sales Amt” field to use that calendar period as a default period does not change the default date field used in to answer our question.

In the end, the only options in the Logical Model that appear to work are the following:

  • In Field and Groups, ungroup all date fields except the one that you want to use.
  • In Field and Groups, assign the date field you want to be the default date into a Calendar group, and assign all the other date fields into a Dimension group.
  • In Field and Groups, assign the date field you want to be a default date into a separate Calendar group from the other date fields, and then in Packages, create a package that combines this group with the group that contains the measures like Sales.

Although these options works, they my prevent you from setting up other desired analysis. After all, it’s not that we don’t want to ever see sales by delivery date, it’s just that we don’t want it to be the default date. We want to make it easier on the user to get the results they expect when the ask for “Sales in 2016” and not have to to type out a longer “Sales Amt for Transaction Date in 2016” statement.

Data Load Script

For as much as we may think that the Logical Model affects how Insight Advisor behaves, and it obviously does, Insight Advisor is also influenced by the data load script and the resulting data model. So much so, that the answer to how Qlik chooses a default date field to answer questions with generic periods is to pick the date field that was loaded first in the data load script.

That’s it! It’s that simple. If I change the order of the fields in the load statement so that “Transaction Date” is loaded before “Delivery Actual Date” then Qlik Insight Advisor answers the question like I want it to and applies the 2016 filter to the transaction date field.

If your data load script does not allow you to change the order in which date fields are loaded, then you can force it by loading an empty field of the same name in the beginning of the script, like the following example.

Load '' as "Transaction Date"
Autogenerate 0;

One More Thing

This logic has been tested and proven to work for new apps. It may not be so easy to assign the default date field once Insight Advisor begins to gather user feedback or obtain additional context through other means. There is a lot going on in Insight Advisor that we are not fulling aware of, but regardless, make sure the date field you think is the most likely to be give the right response to users’ questions is the first date field that is loaded in your data load script. This tiny step may go a long way to increase user adoption faster.