Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Ribeiro
Specialist
Specialist

Select the last record in this set analysis

I need to include a sequence in the analysis of the set below. looking for the last record = Result: 126


Aggr (MaxString ({$ <[CodigoFilial] = {'$ (vCodigoFilial)'}>} Pesquisa), CodigoCliente, NomeCliente))

Max (Sequencia)?

CodigoFilial = 10, Verdade = maria,  Sequencia = 126

Neves
1 Solution

Accepted Solutions
Vegar
MVP
MVP

To fetch the last Sequencia by set analysis to this:

Aggr (MaxString ({$ <Sequencia = {"$(=max(Sequencia ))"},[CodigoFilial] = {'$ (vCodigoFilial)'}>} Pesquisa), CodigoCliente, NomeCliente))

View solution in original post

2 Replies
Vegar
MVP
MVP

To fetch the last Sequencia by set analysis to this:

Aggr (MaxString ({$ <Sequencia = {"$(=max(Sequencia ))"},[CodigoFilial] = {'$ (vCodigoFilial)'}>} Pesquisa), CodigoCliente, NomeCliente))

Ribeiro
Specialist
Specialist
Author

vCodigoFilial = 11

 

LOAD * INLINE [
Cod_Cliente, Sequencia, Filial, Vendedor, Data
1, 10, 9, Ana, 15/01/2019
2, 11, 10, Paula, 16/01/2019
3, 12, 11, Sandra, 17/01 / 2019

4, 12, 11, Sandra, 18/01 / 2019
4, 13, 12, Geisa, 18/01/2019
];

if(Count(DISTINCT{$<[Filial]={'$(vCodigoFilial)'} >}Cod_Cliente),

Aggr(MaxString({$<Sequencia= {"$(=max(Sequencia))"},[Filial]={'$(vCodigoFilial)'}>} Vendedor), Cod_Cliente))

If possible put max (Data)

Result: 4, 12, 11, Sandra, 18/01/2019

Neves