# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

## HELP WITH PEEK()

Hi everyone,

I dont understand why my peek sometimes get strange numbers

In this case appears a number that duplicated and some number off order.

Corrige_Medidor:

DISTINCT

OID_METER,

DATA,

TEMPO

RESIDENT TMP2

ORDER BY OID_METER,DATA,TEMPO DESC;

NoConcatenate

Teste_Medidor:

OID_METER,

VALOR,

DATA,

TEMPO,

peek(VALOR),

peek(VALOR)- VALOR AS DIFERENCA

RESIDENT Corrige_Medidor

ORDER BY OID_METER,DATA,TEMPO DESC;

drop table Corrige_Medidor;

1 Solution

Accepted Solutions
Not applicable

## Re: HELP WITH PEEK()

is your table also sorted by in the same order as the orderby clause?

OID_METER,DATA,TEMPO DESC;

try with Previous(Valor) instead of Peek()

4 Replies
Not applicable

## Re: HELP WITH PEEK()

is your table also sorted by in the same order as the orderby clause?

OID_METER,DATA,TEMPO DESC;

try with Previous(Valor) instead of Peek()

Not applicable

## Re: HELP WITH PEEK()

Hi Eduardo,

it's a bit hard to troubleshoot your app without seeing it, but here is what I think is happening:

1. Your never verify that OID_METER remains the same from the previous records. So, you might be picking up the values of peek(VALOR) from the previous meter ID. In order to avoid that, your formula should be:

IF(Peek(OID_METER) = OID_METER, peek(VALOR), null()) as [Last VALOR]

2. Your data is sorted by OID, Date, and Time (in descending order), but your data in the screenshot is not sorted by Time, hence the "previous" values look confusing. If you sort your table on the screen the same way you sorted your data, it will look less confusing.

If you need a deeper analysis, please post a sample of your App.

cheers,

Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Munich, Germany and Boston, MA!

Not applicable

## Re: HELP WITH PEEK()

Hi Vinneth,

Get the same problem, and i dont know how to check if my table is sorted by OID_METER,DATA,TEMPO DESC

Not applicable

## Re: HELP WITH PEEK()

Hi Vinneth,

That was my mistake, i checked on internet how to order by my table and when i did that the results match.

Thank you very much

Community Browser