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: 
risabhroy_03
Partner - Creator II
Partner - Creator II

Find maximum Sequence for each Item

Hey, I have to find Maximum [Sequence] for each [Item] and for each [Company_Code] .

I am using the below piece of code but for some Item it is working and for some it is not.

[Max_SEQN]:
Mapping
Load
"T$ITEM" & '|' & Company_Code,
floor(num(max("T$SEQN"))) as [Max_SEQN_Updated]
FROM [$(vSource)\TTICPR301.qvd](qvd)
Group By
Company_Code,
"T$ITEM",
"T$INDT";

ApplyMap('Max_SEQN',"T$ITEM" & '|' & Company_Code,'-') as [Max_SEQN_Table],
if(ApplyMap('Max_SEQN',"T$ITEM" & '|' & Company_Code,'-') = floor(num("T$SEQN")),1,0 ) as [Max_SEQN_Flag];

Below is the result - 

risabhroy_03_0-1656261989386.png

As you can see the [Sequence] column is not matching with [Max_SEQN_Table] and hence it is not selecting the maximum.

Please help me.

Labels (5)
0 Replies