Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Micki
Creator
Creator

Get last value by selected dimesnion

Hello, 

I have  a table:

PlanLevel 1Level 2TitleLastResultOutcomeDate
Plan 1TestPoolEventsHistogramNone07-10-20 7:35
Plan 2TestLabEventsHistogramNone09-10-20 12:44
Plan 2TestLabEventsHistogramPassed09-10-20 12:44
Plan 2TestLabEventsHistogramPassed12-10-20 12:24
Plan 2TestLabSI_01HistogramNone30-10-20 10:04

 

And I need to get last value(LastResultOutcome) based on selected dimension. for example, if I select from dimension [Plan] =[Plan 2], following result should be like that:

PlanLevel 1Level 2TitleLastResultOutcomeDate
Plan 2TestLabSI_01HistogramNone30-10-20 10:04

 

If if I select from dimension [Plan] =[Plan 2] and [Level 2] = [Events], following result should be like that:

PlanLevel 1Level 2TitleLastResultOutcomeDate
Plan 2TestLabEventsHistogramPassed12-10-20 12:24

 

What i've done: 

 

Aggr(FirstSortedValue(,-Date),[Plan]) 
FirstSortedValue(aggr([LastResultOutcome],Date,[Plan]),-Date)

 

 

 

And nothing is working 😞

@sunny_talwar 

Thank you so much in advance !

Labels (2)
1 Solution

Accepted Solutions
Micki
Creator
Creator
Author

@agigliotti it's done i add just ditinct to my expression, FirstSortedValue( distinct Aggr(LastResultOutcome,Title), -[Date])

 

image.png

View solution in original post

7 Replies
Gabriel
Partner - Specialist III
Partner - Specialist III

@Micki 

Maybe try this 2 functions

MAXSTRING(LastResultOutcome) 

MINSTRING(LastResultOutcome)

Micki
Creator
Creator
Author

@Gabriel, thanks but it need to be aggregated  by Plan and based on Date 

Micki_1-1604491294551.png

 

Chanty4u
MVP
MVP

it should work. try below

FirstSortedValue([Plan],-Date)

or

FirstSortedValue(Aggr(Plan), Date), -Date)

 

 

agigliotti
Partner - Champion
Partner - Champion

Hi @Micki ,

Maybe this :

=FirstSortedValue( LastResultOutcome, -Date )

as expression to get the last value  of  "LastResultOutcome" field  based on "Date" field.
"Plan" field as dimension.

I hope it helps.

Andrea

Micki
Creator
Creator
Author

Hi, @agigliotti , @Chanty4u ,  based on your suggestions i did expression like FirstSortedValue(Aggr(LastResultOutcome,Title), -[Date]) that was working partially Capture.PNGCapture1.PNG

As you see measures should show also ResultOutcome in area where i mark as yellow, but it's not , honestly i don't know how to aggr() Title column more or else 

agigliotti
Partner - Champion
Partner - Champion

for Title as a calculated dimension you could use the below expression:
=aggr( FirstSortedValue( Title, -Date ), Plan )
OR
could you share a sample app with mock data to look at?

Micki
Creator
Creator
Author

@agigliotti it's done i add just ditinct to my expression, FirstSortedValue( distinct Aggr(LastResultOutcome,Title), -[Date])

 

image.png