Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to exclude wrong records

Hi all,

I have the following problem.

Let's suppose we have the table below, with 3 machines that have worked for 3 months. For each, there are their working hours.

MachineMonthWorking HoursValidity
SC01Jan10yes
SC01Feb12NO
SC01Mar12yes
SC02Jan14yes
SC02Feb12yes
SC02Mar11yes
SC03Jan12yes
SC03Feb10NO
SC03Mar11yes

Users can select a Month and a Machine from a list box, in order to see the sum of hours. This is very simple.

The problem is that some data are wrong and these mistakes are registered in column Validity. If, in the period selected by a user, a machine has wrong data (i.e. Validity =NO), even just for a single month, all records for that machine must be ignored and the list box of Machine must not display that machine. So I have to consider only records that have count(Validity='yes')=GetSelectedCount(Month).

Some examples:

1) if a user selects Jan, all data are available --> no problem!

2) if a user selects all months, SC01 and SC03 mustn't be available and their working hours mustn't be considered.

Thanks in advance for your help!

Elena

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi Elena,

try to add Calculated Dimension

Aggr(If(Validity='yes',Machine),Machine)

and Month

See attachement

Regards,

Antonio

View solution in original post

19 Replies
Anonymous
Not applicable
Author

Hi,

use in your listboxes instead of field an expression:

=if(not match(Validity, 'NO'), Machine)

in your expressions in the table add set analysis to your formula for example:

sum({< Validity = {yes} >} [Working Hours])

you could also filter the data in script. but this will obviously only work if you dont need not valid machine data in the ui at all.

Best regards

Stefan

ecolomer
Master II
Master II

If you present info in a pivot table simple you have all (I think)

p02.png

ecolomer
Master II
Master II

And also with totals for validity

p02.png

ecolomer
Master II
Master II

The qvw file

Anonymous
Not applicable
Author

Hi,

You may try below script,

Sum({$<Machine=E({1<Validity={NO}>})>} [Working Hours])

Thanks

maxgro
MVP
MVP

I think you just have to replace 1 with $ because the Machine to exclude depends on the selection

Sum({$<Machine=E({$<Validity={NO}>})>} [Working Hours])

Anonymous
Not applicable
Author

Thank for your all suggestions!

@Massimo: your instruction perfectly works with selections on month, but it doesn't work when a machine is selected...

Maybe it's not possible to implement this kind of logic...

antoniotiman
Master III
Master III

Hi Elena,

try to add Calculated Dimension

Aggr(If(Validity='yes',Machine),Machine)

and Month

See attachement

Regards,

Antonio

Anonymous
Not applicable
Author

Thank you Antonio!

It sounds good

Thanks!