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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Flag to show record count

Hi,

I need a flag to show records where count is more than 1.

I am trying this in the script "if(count(fieldname > 1, 1,0) as flag"  or  in the listbox but it's not working. I would prefer it to be outside the script.

So by clicking 1 the user gets to see the duplicates and by clicking 0 unique records.

Please advise

Thanks

1 Solution

Accepted Solutions
sunny_talwar

You can probably combine this into one like this:

Data:

ID,      // ID is key field

Field

FROM table;

New:

LOAD ID,

         If(Count(Field) > 1, 1, 0) as Flag

resident Data

group by ID;

DROP Table Data;

View solution in original post

8 Replies
Kushal_Chawda

Data:

ID,      // ID is key field

Field

FROM table;

new:

LOAD *,

          if(Cnt>1,1,0) as Flag;

LOAD ID,

         Count(Field) as Cnt

resident Data

group by ID;

sunny_talwar

You can probably combine this into one like this:

Data:

ID,      // ID is key field

Field

FROM table;

New:

LOAD ID,

         If(Count(Field) > 1, 1, 0) as Flag

resident Data

group by ID;

DROP Table Data;

Anonymous
Not applicable
Author

Thanks Sunny, it works

ashishkalia
Partner - Creator
Partner - Creator

Do you really want to Flag in backend.

Else you can do following:-

  • Make an inline table

LOAD * INLINE [

    Flag

    1

    0

];

  • Create a text object and Write a logic as "  if(Flag = 1, count(Field) , count(DISTINCT Field) )".
  • Take Flag field as selection, when you select 1 expression will show redundant result but on selecting 0 it will show Unique count.  In same way you can play around any thing you are trying to show.
Kushal_Chawda

I don't think it will make much difference. Do you think different?

sunny_talwar

For a small set of data, no. But for a big data set with a lot of ids, preceding load can be bad. Remember our yesterday's discussion where Marcus was talking about how preceding load can slow down.

The Cost of Preceding Load | Qlikview Cookbook

Kushal_Chawda

@sunnysahni  is this solution not working?

Kushal_Chawda

Yeah correct.