Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Talk to Experts, a LIVE Q&A Webinar. Bring your Qlik Sense Business questions on Aug. 4th. Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Create Duplicate Flag in Load Script

Simple one I hope.  I have created a duplicate flag in the script which the load does not like. Is there something wrong with the formula or can it simply not be done???

if(count(EpisodeNumber) - Count(distincEpisodeNumber) >1,1,0) as DuplicateEpisode_Flag,

Thanks!

 

1 Reply
Highlighted
Partner
Partner

Re: Create Duplicate Flag in Load Script

You would need to aggregate your count first:

DistinctEpisode:

load distinct EpisodeNumber

resident <YourTable>;

let vDistinctEpisodeNum=NoOfRows('DistinctEpisode');

drop table DistinctEpisode;

Table:

load 

<Dim1>,

<Dim2>,

count(EpisodeNumber)as EpisodeNumber

resident <YourTable>

group by 

<Dim1>,

<Dim2>;

Data:

load *, if(EpisodeNumber-$(vDistinctEpisodeNum)>1,1,0)as DuplicateEpisode_Flag

resident Table;

drop table Table;

drop table <YourTable>;