Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Max1
Contributor II
Contributor II

Calculate number of Min()

Hi,

I'm new so tried here for the first time 🙂

I have a qvd like this :

A

BCdatenb
TEXT1TEXT1TEXT110/01/20181
TEXT2TEXT2TEXT220/01/20181
TEXT2TEXT2TEXT221/01/20181
TEXT3TEXT3TEXT330/01/20181
TEXT3TEXT3TEXT330/01/20181

 

I would like to obtain the nb of minimum date :

A

BC=min(date)nb of minimum date
TEXT1TEXT1TEXT110/01/20181
TEXT2TEXT2TEXT220/02/20181
TEXT3TEXT3TEXT330/03/20182

 

I have tried this but it's not enough : Aggr(Min(date), A, B, C)

Do you know someting to do that ?

2 Replies
Taoufiq_Zarra

Data:
LOAD * INLINE [
    A, B, C, date, nb
    TEXT1, TEXT1, TEXT1, 10/01/2018, 1
    TEXT2, TEXT2, TEXT2, 20/01/2018, 1
    TEXT2, TEXT2, TEXT2, 21/01/2018, 1
    TEXT3, TEXT3, TEXT3, 30/01/2018, 1
    TEXT3, TEXT3, TEXT3, 30/01/2018, 1
];

output:
noconcatenate
load A,B,C, min(date) as min resident Data group by A,B,C;
left join load * resident Data;

drop table Data;

final:
noconcatenate

load if(date=min,1,0) as flag,* resident output;

drop table output;

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Max1
Contributor II
Contributor II
Author

First thank you for your solution. 

I forget to mention explicitly I was trying to do this with Set Analysis and not in Script in order to calculate with a selected date in filter (pivot period)

Is there any possibility with Set Analysis (or not recommended) ?