Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Gartner® Magic Quadrant™: 15 YEARS A LEADER - GET THE REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlik1_User1
Specialist
Specialist

Reducing data from raw data based on condition

Hi ,

I have a sample data like below, there can be 10000 of users

Temp:
Load * inline [
ACCESS, USER, ID1, ID2,ID3, ID4
'USER','N',1,2,3,41,
'USER','N',1,2,3,ALL
'USER','N',1,2,3,42,
'USER','N',1,2,3,ALL
'USER','N',1,2,3,43,
'USER','N',1,2,3,ALL
'USER','A',1,2,3,44,
'USER','A',1,2,3,45

];
Scenario -  User N has values 'All' and other value in ID4, so for User N expected data is to get a  row with value ALL.
And USER A has only value 44 in ID4 column so that records only.

So here ACCESS, USER, ID1, ID2,ID3 will be composite key so based on this key we need to check if that key has ALL and other values in ID4 if it has ALL just return row will ALL and if composite key don't have ALL value in ID4 just return as it is
below data is expected

EXPECTED OUTPUT
'USER','N',1,2,3,ALL
'USER','A',1,2,3,44
'USER','A',1,2,3,45

Please help. 
@Kushal_Chawda @Vegar 

1 Reply
Chanty4u
MVP
MVP

Try this 

Test:

LOAD * INLINE [

ACCESS, USER, ID1, ID2, ID3, ID4

'USER', 'N', 1, 2, 3, 41

'USER', 'N', 1, 2, 3, ALL

'USER', 'N', 1, 2, 3, 42

'USER', 'N', 1, 2, 3, ALL

'USER', 'N', 1, 2, 3, 43

'USER', 'N', 1, 2, 3, ALL

'USER', 'A', 1, 2, 3, 44

'USER', 'A', 1, 2, 3, 45

];

 

Final:

LOAD

    ACCESS,

    USER,

    ID1,

    ID2,

    ID3,

    MinString(ID4) as ID4 

Resident Test

Group By ACCESS,

USER, ID1, ID2, ID3;