Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

[ask] show first and last data each second

hello qlikview world

i wanna ask a problem that i can't solve

i have 3 column : premary key, time, price

source.png

and i want to show the first and last data each second

it will show something like below :

timepremary key
first
last
14:56:20195142-
14:56:20200-142
14:56:34186142-
14:56:34194-142
...


...


...


15:04:07165144-
15:04:07167-144




















how to do that?

many thx....

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Sorry i forget to add Group by clause in it because first value and last value function will work only with group by.

    

source_filter:

  Load

          Time,

          FirstValue(Premary_Key) as FirstPremaryKey,

          LastValue(Premary_Key) as LastPremaryKey,

          FirstValue(Price) as firstprice,

          LastValue(Price) as lastprice

Resident source Group by Time;

It will work.

Celambarasan

View solution in original post

8 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Are you expecting this in load script or in presentation?

Celambarasan

Not applicable
Author

halo celambarasan..

i want to show this in presentation of qlikview

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

If you are need this in load try this.

     Table:

      Load

               time,

               premary key,

               price

     From ..

     OutPut:

     Load

          time,

          FirstValue(premary key) as FirstPremaryKey,

          LastValue(premary key) as LastPremaryKey,

          FirstValue(price) as first,

          LastValue(price) as last

     Resident

          Table;

         

Hope it helps

Celambarasan

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Can you upload the sample data to work with it?

Celambarasan

Not applicable
Author

hi...

i've tried yours but it shows error :

Invalid expression

source_filter:

  Load

          Time,

          FirstValue(Premary_Key) as FirstPremaryKey,

          LastValue(Premary_Key) as LastPremaryKey,

          FirstValue(Price) as firstprice,

          LastValue(Price) as lastprice

Resident source

many many thx

sridhar240784
Creator III
Creator III

Hi,

You have missed your group by clause.

source_filter:

  Load

          Time,

          FirstValue(Premary_Key) as FirstPremaryKey,

          LastValue(Premary_Key) as LastPremaryKey,

          FirstValue(Price) as firstprice,

          LastValue(Price) as lastprice

Resident source

Group by Time;

-Sridhar

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Sorry i forget to add Group by clause in it because first value and last value function will work only with group by.

    

source_filter:

  Load

          Time,

          FirstValue(Premary_Key) as FirstPremaryKey,

          LastValue(Premary_Key) as LastPremaryKey,

          FirstValue(Price) as firstprice,

          LastValue(Price) as lastprice

Resident source Group by Time;

It will work.

Celambarasan

Not applicable
Author

many thx for both of you..

many many thx...

may god with you