Skip to main content
Announcements
Happy New Year! Cheers to another year of collaboration, connections and success.
cancel
Showing results for 
Search instead for 
Did you mean: 
fmvelez
Contributor II
Contributor II

Obtener el valor más reciente de un campo con Set Analysis

Hola, deseo obtener el valor más reciente con el cual fue comprado un producto, intento con la siguiente fórmula pero no obtengo resultado

sum({<[%KeyFecha]={"$(=Max([%KeyFecha]))"}>}PrecioUnitarioCompra)

Agradezco la ayuda

Labels (4)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

looks like you just need to format the date value

sum({<[%KeyFecha]={"$(=Date(Max([%KeyFecha]),'YYYY-MM-DD'))"}>}PrecioUnitarioCompra)

replace YYYY-MM-DD with the date format as in [%KeyFecha]

 

refer below blog to learn more

https://community.qlik.com/t5/Qlik-Design-Blog/Dates-in-Set-Analysis/ba-p/1472511

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

6 Replies
vinieme12
Champion III
Champion III

If  [%KeyFecha]) is a numeric value then Try below

=FirstSortedValue(PrecioUnitarioCompra,-[%KeyFecha])

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
fmvelez
Contributor II
Contributor II
Author

Muchas gracias, 

Aún no llego a la respuesta.

vinieme12
Champion III
Champion III

1) is [%KeyFecha]   a numeric value?

Validate it  as ISNUM( [%KeyFecha]) , if the return value is -1 , then its a numeric value; if it returns 0, means its not a numeric value

Max() will only work on numeric values

 

2)can you post some screenshot  of the Edit Expression box so we can see what your expression is currently evaluating to  and your Data Model ?

qlikCommunity1.PNG

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
fmvelez
Contributor II
Contributor II
Author

Hola, realicé la prueba con Isnum y regresa un valor 0.

Envío imagen

Gracias

vinieme12
Champion III
Champion III

looks like you just need to format the date value

sum({<[%KeyFecha]={"$(=Date(Max([%KeyFecha]),'YYYY-MM-DD'))"}>}PrecioUnitarioCompra)

replace YYYY-MM-DD with the date format as in [%KeyFecha]

 

refer below blog to learn more

https://community.qlik.com/t5/Qlik-Design-Blog/Dates-in-Set-Analysis/ba-p/1472511

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
fmvelez
Contributor II
Contributor II
Author

Muchas gracias por el apoyo