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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ahmd
Contributor II
Contributor II

How to Show latest value in text object

Hi,

I want to show latest value in text object from given below table.

I want to show only latest day value without any selection. In my scenario, I have 26.02.2020 latest day.

I tried with this expression but doesn't work: 

Only({<Dim3 = {'=Max(Dim3)'}>} Values)

 

Dim 1Dim 2Dim 3Values
AAA26.02.20205
AAA24.02.20203
AAA16.02.20202
AAA01.02.20204
AAA18.01.20206
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Like:

=Sum(Aggr(FirstSortedValue(Values,-[Dim 3]), [Dim 2]))

View solution in original post

8 Replies
GaryGiles
Specialist
Specialist

You want to enclose Max(Dim3) in a $-expansion, like this:

Only({<Dim3 = {'$(=Max(Dim3))'}>} Values)

JuanGerardo
Partner - Specialist
Partner - Specialist

Hi @ahmd, you need to use dollar sign expansion to include the max date in your selection, something like this:

Only({<Dim3 = {'$(=Max(Dim3))'}>} Values)

And if you want to get this value, independently from the user selection, you have to use the 1 modifier:

Only({1<Dim3 = {'$(=Max(Dim3))'}>} Values)

 

JG

ahmd
Contributor II
Contributor II
Author

Hi @GaryGiles  / @JuanGerardo ,

It works only for the Single value. But, if there are more values then what should be the expression?

For example:

26.02.2020 is the max date for Dim 1 = A, Dim2 = AA, Values = 5

24.02.2020 is the max date for Dim 1 = B, Dim2 = BB, Values = 3

02.02.2020 is the max date for Dim 1 = C, Dim2 = CC, Values = 1

 

So,  the result should be sum of 5 + 3 + 1 = 9.

 

Dim 1, Dim 2, Dim 3, Values
A, AA, 26.02.2020, 5
A, AA, 24.02.2020, 3
A, AA, 16.02.2020, 2
A, AA, 01.02.2020, 4
A, AA, 18.01.2020, 6
B, BB, 24.02.2020, 3
B, BB, 23.02.2020, 4
C, C, 02.02.2020, 1
C, C, 01.02.2020, 4

tresesco
MVP
MVP

Like:

=Sum(Aggr(FirstSortedValue(Values,-[Dim 3]), [Dim 2]))

ahmd
Contributor II
Contributor II
Author

Hi @tresesco ,

it returns me 0 Values.

tresesco
MVP
MVP

For me  - 9

tresesco_0-1620044754930.png

 

ahmd
Contributor II
Contributor II
Author

Hi @tresesco ,

Still I am receiving 0.

 

tresesco
MVP
MVP

Please be convinced that you are doing something wrong in your expression or not explaining the entire scenario. With just 'Sill I am receiving 0' , it is going to be very hard for us here to understand what could be the reason.