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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Fig1
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
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

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>;