Lena
Lena

Reputation: 1

Qlik Sense Button selecting errors (duplicates)

I'm very new to Qlik Sense and doing my very first button for Qlik report (table chart). Button should select "errors", or in another words, find out if there's the same vaccination date (Time column in my report) for the same person (Owner column shown as "Own..." in attachment picture from my report) and select them showing all the information of those owners highlighting the duplicate dates.

Picture from my table chart: Vaccinations Table Chart

Unfortunately I don't have any idea what actions I should use for the button (I have been considering "select values in the field" and "select values matching search criteria, but haven't figured out the right expressions).

Is the either one of those two the right choice or should I use different button action? What about the expression for the value. I have been considering if function. I know you can give many actions for the button. I presume I must make more than one action. Or is it possible to do my task with only one action?

Upvotes: 0

Views: 511

Answers (1)

Stefan Stoychev
Stefan Stoychev

Reputation: 5012

For simplicity (and general dashboard performance) you should/can "solve" these by creating an additional field (flag) during the reload.

The idea is to flag the records that are in "error". Once the field/flag is available then the frontend job becomes simpler. In your case the button/filter should just select value in the new field.

Example script:

RawData:
Load * Inline [
Owner, Time, 
1    , 2019-03-08 09:26:31
1    , 2019-03-08 09:26:31
1    , 2019-04-08 07:13:57
2    , 2019-07-04 08:00:00
2    , 2020-02-20 08:55:00
2    , 2020-05-26 09:30:11
3    , 2020-07-16 04:55:00
4    , 2019-05-02 15:29:00
5    , 2019-07-10 09:45:27
5    , 2019-11-25 10:38:31
];

left join (RawData)

Errors:
// if the TimeCount column is greater than 1 then populate
// with True else False (no necessary to be True/False. can be anything)
// and join back to the main table
Load 
  Time,
  Owner,
  if(TimeCount > 1, True(), False()) as isError
;
// count Time values for each Owner
Load distinct
  count(Time) as TimeCount,
  Time,
  Owner
Resident
  RawData
Group By
  Time,
  Owner
;

After the reload the table will contain the new isError field and we can filter on it.

Data table preview

P.S. The script above is one way to solve this.

  • Another approach is to flag only the "errored" records (for the rest the isError will be null())
  • im joining the Errors table back to the original table. In some cases might be better to not modify the main table but to keep the Errors table separate and just link it to the main table

Upvotes: 0

Related Questions