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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Jsobrinho77
Creator
Creator

return the last value qliksense table

Hi guys,

I need to show the last value for the column Value, based on Month column, how can I do this? Independent the table sort (asc or desc ...because I tried to use above and below and when I change the sort the values it's changed).

 

In this example, 01/02/2023 needs to show 9,80

Jsobrinho77_0-1686317812226.png

 

 

Labels (3)
5 Replies
BrunPierre
Partner - Master II
Partner - Master II

As below.

LOAD *,
If(Len(Trim(Value))=0, Peek(NewValue), Value) as NewValue
Inline [
Month,Value
01/01/2023,980
01/02/2023,
01/03/2023,1024
01/04/2023,1024
01/05/2023,1024
01/06/2023,1024 ];

Exit Script;

Digvijay_Singh

Please share expected output!

Jsobrinho77
Creator
Creator
Author

first of all, thank you for your answer...

the expected result is, because this is the previous value, or if 01/01/2023 is null the expected value is 10,24 because is the next value. basically I need to show the close value.

Jsobrinho77_0-1686332743045.png

 

 

Digvijay_Singh

Not sure of the expectations when multiple values are nulls  but aggr helps to sort values month wise and keep results consistent..

Digvijay_Singh_0-1686334197808.png

aggr(Coalesce(Value,above(Value),Below(Value),above(above(Value)), below(below(Value))),(Month,(NUMERIC,ASCENDING)))

 

I know it won't help completely but may be you get some new ideas to solve the problem 🙂

BrunPierre
Partner - Master II
Partner - Master II

BrunPierre_1-1686345817344.png


As below.

LOAD *,
If(Len(Trim(Value))=0, Peek(NewValue), Value) as NewValue
Inline [
Month,Value
01/01/2023,980
01/02/2023,
01/03/2023,1024
01/04/2023,1024
01/05/2023,1024
01/06/2023,1024 ];

Exit Script;