Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
risabhroy_03
Partner - Creator II
Partner - Creator II

Find minimum for each record

I have to find minimum [Task No] for records based on "T$PITM" , "T$BPID", "T$TANO" , Company_Code.

My code is working fine for maximum but it is not working as expected for Minimum.

Below is my code for Maximum - 

[Min_Date_SEQN]:
Mapping
Load
"T$PITM" & '|' & "T$BPID" & '|' & "T$TANO" & '|' & Company_Code,
max("T$SEQN") as [Min_SEQN_Updated]
FROM [$(vSource)\TTIUIL160.qvd](qvd)
Group By
Company_Code,
"T$PITM",
"T$BPID",
"T$TANO";

And I am using the below inside my table - 

if(ApplyMap('Max_Date_EFDT',"T$PITM" & '|' & "T$BPID" & '|' & "T$TANO" & '|' & Company_Code,'-') =floor(num("T$EFDT")),1,0 ) as [Max_Date_EFDT_Flag],

And I am using this like - 

where [Max_Date_EFDT_Flag]=1;

It works perfect.

Please help me to the same with Minimum, I replaced Max with min but it is not coming correct.

Labels (1)
2 Replies
edwin
Master II
Master II

i suggest you make your expression consistent, add floor(num("T$EFDT")) into your min and max expressions.

however, if the field is a date maybe you should use dates instead: date(min()) and date(max()) and then use FIELD=applymap(...)

you will need to observe proper date formats

Kasey001
Contributor
Contributor

When doing a publish and replace, Qlik Sense replaces the set described in (1) with whatever is in the app being published on top of the published https://testmyspeed.onl/ app.