Qlik Community

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.
eduardo_dimperi
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.

any help please.

Corrige_Medidor:

LOAD

DISTINCT

OID_METER,

VALUE_READ AS VALOR,

DATA,

TEMPO

RESIDENT TMP2

ORDER BY OID_METER,DATA,TEMPO DESC;

NoConcatenate

Teste_Medidor:

LOAD

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;

Data_Erro.JPG

1 Solution

Accepted Solutions
vinieme12
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
vinieme12
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()

Oleg_Troyansky
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!

eduardo_dimperi
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

eduardo_dimperi
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