Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
krmvacar
Creator II
Creator II

Max create date aggr

Hi guys ,

I want to 

SUM({<(max([date]),[DOCNO]={'31'})>} [.GRANDTOTAL]) ,its not working.

Can you help me?

1 Solution

Accepted Solutions
MayilVahanan

Hi @krmvacar 

If you have one record per combination, try like below


Temp:
LOAD * INLINE [
CREATEDATE, DOCNO, GRANDTOTAL
12.01.2021, 31, 148
15.01.2021, 31, 148
18.01.2021, 31, 156
];

Load *, if(GRANDTOTAL <> Peek('GRANDTOTAL'), 1, 0) as flag
Resident Temp Order By GRANDTOTAL, DOCNO, CREATEDATE desc;

DROP Table Temp;

EXIT SCRIPT;

MayilVahanan_0-1612344190115.png

Exp: SUM({<flag={1}>} [GRANDTOTAL])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

8 Replies
GaryGiles
Specialist
Specialist

I think what you might be looking for is:

SUM({<[date]={'$(=max([date]))'},[DOCNO]={'31'}>} [.GRANDTOTAL]) 

 

krmvacar
Creator II
Creator II
Author

Thank you for answer. ı try But is not working. Answer give me zero:( 

 

SUM({<[CREATEDAT]={'$(=max([CREATEDAT]))'},[DOCNO]={'31'}>} [GRANDTOTAL])

MayilVahanan

Hi @krmvacar 

Try like below

SUM({<[CREATEDAT]={"$(=Date(max([CREATEDAT]),'DD/MM/YYYY'))"},[DOCNO]={'31'}>} [GRANDTOTAL])

Change the DD/MM/YYYY date format to ur Createdat date format.

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
krmvacar
Creator II
Creator II
Author

Hİ MayilVahanan,

I try but not working.

My data;

Ekran Alıntısı_1.PNG

Now ı want to show,

Ekran Alıntısı_2.PNG

and ı want to result=304.

Thank you so much

 

 

MayilVahanan

HI @krmvacar 

So, you don't want max date for entire DocNo, its based on GrandTotal?
Your source has single record per date, docno & GrandTotal? or multiple singles available per date, docno?

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
krmvacar
Creator II
Creator II
Author

Hi @MayilVahanan 

Your source has single record per date, docno & GrandTotal. 

MayilVahanan

Hi @krmvacar 

If you have one record per combination, try like below


Temp:
LOAD * INLINE [
CREATEDATE, DOCNO, GRANDTOTAL
12.01.2021, 31, 148
15.01.2021, 31, 148
18.01.2021, 31, 156
];

Load *, if(GRANDTOTAL <> Peek('GRANDTOTAL'), 1, 0) as flag
Resident Temp Order By GRANDTOTAL, DOCNO, CREATEDATE desc;

DROP Table Temp;

EXIT SCRIPT;

MayilVahanan_0-1612344190115.png

Exp: SUM({<flag={1}>} [GRANDTOTAL])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
krmvacar
Creator II
Creator II
Author

Thank you so much

 

its working 😀