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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to pick the most recent month ?

PFA Sample QVW.How to pick the most recent month for each ID?

Thanks much.

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

A slightly different way to assign numerical value to month:

=FirstSortedValue(Aggr(Sum(Amount), [Invoice Month], Code), -Aggr(Max(Date#([Invoice Month], 'MMM')), [Invoice Month], Code)) * 12


Capture.PNG


View solution in original post

3 Replies
pk2019
Partner - Contributor III
Partner - Contributor III

Hi Pavana,

The answer is found in this post:

Get Max Date and Max Value of a ID

Cheers,

Paul

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

=FirstSortedValue( aggr(sum(Amount),[Invoice Month],Code), aggr(-max(match([Invoice Month], 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') ),[Invoice Month],Code))*12

Alternatively replace your textual month field with a field that has a numeric value. That way you can replace the max(match(... )) construction with the name of the numeric field.


talk is cheap, supply exceeds demand
sunny_talwar
MVP
MVP

A slightly different way to assign numerical value to month:

=FirstSortedValue(Aggr(Sum(Amount), [Invoice Month], Code), -Aggr(Max(Date#([Invoice Month], 'MMM')), [Invoice Month], Code)) * 12


Capture.PNG