Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
eduardo_dimperio
Specialist II
Specialist II

"Concatenate" Fields

Hi people,

I need some help please.

I did this code below, with the result like the image, but i need to show Consumo0 (today), Consumo1(today -1) and Consumo2(today -2), side by side.

The problem is each read are was diferent day. How can i do this?

ANALISE_TMP:

LOAD

  ID_LEITURA,

    NAME_SYSTEM,

    NAME_GROUP,

    NEIGHB_SYSTEM,

    CITY_SYSTEM,

    OID_METER,

    NAME_TYPE_METER,

    TYPE_CONSTANT,

    NAME_UC,

    ADDRESS_BLOCK_UC,

    DATE_READ,

    VALUE_READ,

    If(OID_METER=  Peek(OID_METER) and Floor(DATE_READ)= Floor(Today()),(Peek(VALUE_READ)- VALUE_READ) * TYPE_CONSTANT)   as CONSUMODIA0,

    If(OID_METER=  Peek(OID_METER) and Floor(DATE_READ)= Floor(Today()-1),(Peek(VALUE_READ)- VALUE_READ) * TYPE_CONSTANT) as CONSUMODIA1,

    If(OID_METER=  Peek(OID_METER) and Floor(DATE_READ)= Floor(Today()-2),(Peek(VALUE_READ)- VALUE_READ) * TYPE_CONSTANT) as CONSUMODIA2

  RESIDENT TMP2 WHERE OID_METER=70794 AND NAME_UC ='ZELADORIA'

    ORDER BY OID_METER DESC;

CONSUME.PNG

15 Replies
eduardo_dimperio
Specialist II
Specialist II
Author

Hi,

About my output, how can i put in order in a line by hour my select?

I made a example between what i have and what i want.

Thank you for the pacience

ANALISE:

LOAD

  ID_LEITURA,

    NAME_SYSTEM,

    NAME_GROUP,

    NEIGHB_SYSTEM,

    CITY_SYSTEM,

    OID_METER,

    NAME_TYPE_METER,

    NAME_UC,

    ADDRESS_BLOCK_UC,

    HORA,

    CONSUMODIA0,

    CONSUMODIA1,

    CONSUMODIA2

    RESIDENT ANALISE_TMP;CONSUME.PNG

Anonymous
Not applicable

Make a table in QS with dimension  = the date/time field and measure = max(consumodia0).

eduardo_dimperio
Specialist II
Specialist II
Author

But i dont want only the max value of consumodia0, i need all values organized by hour

That way, the result is quite diferent of what i need

CONSUME.PNG

Anonymous
Not applicable

Maybe you could post some data or a *.qvf.

eduardo_dimperio
Specialist II
Specialist II
Author

Unfortunately not, because it's confidential information.

But's ok ill figure out something.


I think the problem is about my field HORA, thats dont have distinct values

eduardo_dimperio
Specialist II
Specialist II
Author

Hi everyone,

I finally resolve the problem:

ANALISE:

LOAD

  OID_METER,

    ID_LEITURA,

    NAME_SYSTEM,

    NAME_GROUP,

    NEIGHB_SYSTEM,

    CITY_SYSTEM,

    NAME_TYPE_METER,

    TYPE_CONSTANT,

    NAME_UC,

    ADDRESS_BLOCK_UC,

    DATE_READ,

    VALUE_READ,

    CONSUMODIA0,

    CONSUMODIA1,

    CONSUMODIA2,

    If (OID_METER =PEEK(OID_METER), PEEK(CONSUMODIA0)- CONSUMODIA0) AS CONSUMO_REAL0,

    If (OID_METER =PEEK(OID_METER), PEEK(CONSUMODIA1)- CONSUMODIA1) AS CONSUMO_REAL1,

    If (OID_METER =PEEK(OID_METER), PEEK(CONSUMODIA2)- CONSUMODIA2) AS CONSUMO_REAL2,

    HORA

    RESIDENT ANALISE_TMP

after i use SUM() in the grafic part.

Thank all for the help