Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can you help in getting the latest Index Value from a Table contains
Unique_ID,
Index,
TimeStamp
ID | Index | TimeStamp | |
---|---|---|---|
Orange | 3 | 22/05/2017 12:30:00 | |
Orange | 4 |
| |
Apple | 3 | 15/02/2017 6:30:00 | |
Apple | 4 | 16/03/2017 8:00:00 | |
Mango | 3 | 21/05/2017 8:30:00 | |
Mango | 4 | 21/05/2017 9:00:00 |
I have seen other discussions as well. But, i could not get the solution.
Expected Solution:
Orange = Index is 3
Apple = Index is 4
Mango= Index is 4
Thanks!!!
Hi,
What you need is firstsortedvalue() function.
Check below links.
http://www.learnqlikview.com/first-sorted-value-function-in-qlikview/
Regards,
Kaushik Solanki
Hye,
try
=FirstSortedValue(Index, -Timestamp)
Hi,
If i give
=FirstSortedValue(ACTION_INDEX,Time_stamp)
It shows the first date index value.It has to show latest index.
=FirstSortedValue(ACTION_INDEX,-Time_stamp). It results '-'
Thanks
What i've done :
Table_Test:
LOAD * INLINE [
ID, Index, Timestamp
Orange , 3 , 22/05/2017 12:30:00
Orange , 4 , 22/04/2017 14:30:00
Apple , 3 , 15/02/2017 6:30:00
Apple , 4 , 16/03/2017 6:30:00
];
Dimension : ID
Measure : =FirstSortedValue(Index,-Timestamp)
and works fine ..
Are you sure you dont have null value in your date or index ?
Hi..
Thank You for your answer. It looks like working when i give separate expression.
I am trying to add this in if with other conditions.It gives error as Invalid Dimension.
Please help
can you post your code ?
Hi,
It is
if( R_NAME = 'M_USER' AND FirstSortedValue(INDEX,-TIMESTAMP) ='3' ,'ForCancellation')
In Dimension formula, It is OK But when i click Apply, it is Invalid Dimension
I dont really understand your goal.
Can you provide sample data or sample application to work on?
Hi,
I have give this in load script
Load
FirstSortedValue( INDEX,-Time_stamp) as R_C_Index
Resident DOCS;
It gives correct value if there are two values (3,4)for One ID. It gives 3.
But, If a ID contains value 4, then also it shows 3.
It looks like for any id, it shows 3 is the value of R_C_Index