Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
axnvazquez
Contributor III
Contributor III

Max(date) in set analysis

Hi everyone ! I need help with this issue, because i had dates for each costumer sale, but in my table I need to get the sale of the last sale - max(date)

Captura.PNG

This is the function wich calculates the price for the las sale :

sum({$< _PITR_TYMTD={1}  , Origen_Dato={'Real'}, Mes=, Año=>} DCVC_TOTR_LOC_SIMP) /

Sum({$< _PITR_TYMTD={1}  , Origen_Dato={'Real'} ,Mes= , Año=>} DCVC_PESO)/20

But I need to set the last date, so i made the variable UltimaFecha =MAX({$<DCVC_TOTR_LOC_SIMP = {">=0"}, Mes=,Año=> } [%FECHA])

But i tried so many ways to set that date in the set analysis for the sum, but i cant display it .

I tried month, year, etc

Any help will be so helpfull !

Regards !

5 Replies
Anil_Babu_Samineni

You can use like below. Don't worry about Errors due to this is bug. May be next version they may released

sum({$< _PITR_TYMTD={1}  , $(UltimaFecha), Origen_Dato={'Real'}, Mes=, Año=>} DCVC_TOTR_LOC_SIMP) /

Sum({$< _PITR_TYMTD={1}  , $(UltimaFecha), Origen_Dato={'Real'} ,Mes= , Año=>} DCVC_PESO)/20

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Kushal_Chawda

try this

I have assumed date format "MM/DD/YYYY".  Please give actual date format if field [%FECHA]

sum({$< _PITR_TYMTD={1}  , Origen_Dato={'Real'},[%FECHA]={"$(=date(MAX({$<DCVC_TOTR_LOC_SIMP = {">=0"}, Mes=,Año=> } [%FECHA]),'MM/DD/YYYY'))"}, Mes=, Año=>} DCVC_TOTR_LOC_SIMP) /

Sum({$< _PITR_TYMTD={1}  , Origen_Dato={'Real'} ,[%FECHA]={"$(=date(MAX({$<DCVC_TOTR_LOC_SIMP = {">=0"}, Mes=,Año=> } [%FECHA]),'MM/DD/YYYY'))"},Mes= , Año=>} DCVC_PESO)/20

axnvazquez
Contributor III
Contributor III
Author

Hi Anil ! thanks for the reply ! I tried the expression that you give, but is not displaying any value.

cap.PNG

Anil_Babu_Samineni

Will you available to provide QVF file to check?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
axnvazquez
Contributor III
Contributor III
Author

Anil, I can't provide de QVF file, sory i am not allowed to do that .

I tried to do something like this

sum({$< _PITR_TYMTD={1}  , [%FECHA]={$(=UltimaFecha)}>}, Origen_Dato={'Real'}, Mes=, Año=>} DCVC_TOTR_LOC_SIMP) /

Sum({$< _PITR_TYMTD={1}  ,[%FECHA]={$(=UltimaFecha)}>}, Origen_Dato={'Real'} ,Mes= , Año=>} DCVC_PESO)/20

But it doesn't work