Qlik Community

Ask a Question

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik Users, make your voice heard! Participate in Wisdom of Crowds® Market Study: Start Survey
cancel
Showing results for 
Search instead for 
Did you mean: 
vipingarg23
Creator
Creator

First Occurrence of the filed

Hi Team,

I have below data

IDDesc
1234A
1234B
1234C
5678T
5678J

 

Need Output as below (I need desc based on First occurrence of ID):

 

IDDesc
1234A
5678T
2 Solutions

Accepted Solutions
Vegar
Partner
Partner

You could use EXISTS(). It is quite effective. See example below, it will give you the desired result.

DATA:
LOAD * INLINE [
ID	Desc
1234	A
1234	B
1234	C
5678	T
5678	J]
(delimiter is '	')
WHERE NOT Exists(ID)
;

 

Plees ekskuse my Swenglish and or Norweglish spelling misstakes

View solution in original post

Kush
MVP
MVP

 

Data:
LOAD ID,DESC
FROM YourQVD;

// Sort your data on next load to get the correct values

Final:
LOAD *
where Flag=1;
LOAD *,
     if(rowno()=1 or ID<>previous(ID),1,0) as Flag
resident Data
order by ID,Desc;

drop table Data;

 

View solution in original post

2 Replies
Vegar
Partner
Partner

You could use EXISTS(). It is quite effective. See example below, it will give you the desired result.

DATA:
LOAD * INLINE [
ID	Desc
1234	A
1234	B
1234	C
5678	T
5678	J]
(delimiter is '	')
WHERE NOT Exists(ID)
;

 

Plees ekskuse my Swenglish and or Norweglish spelling misstakes

View solution in original post

Kush
MVP
MVP

 

Data:
LOAD ID,DESC
FROM YourQVD;

// Sort your data on next load to get the correct values

Final:
LOAD *
where Flag=1;
LOAD *,
     if(rowno()=1 or ID<>previous(ID),1,0) as Flag
resident Data
order by ID,Desc;

drop table Data;

 

View solution in original post