Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
balrajprabhu
Creator II
Creator II

find max quarter (Year-Q1)

I have a field where the values are stored as

2001-Q1

2002-Q4

2000-Q2

.

.

.So on

I want to find the max value in the front end. ,and its should be displayed in 'YYYY-Q' format

Any tips ..as they are interpreted as string values

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Doesn't

=MaxString(QuarterField)

return the latest quarter?

But it might be good to interpret your values as duals, so you can use Date /Time functions on them.

edit: Interpreting like

LOAD *,

Dual(Quarter, QuarterStart(Makedate(Left(Quarter,4)),Right(Quarter,1)-1)) as QuarterDual

INLINE [

Quarter

2001-Q1

2002-Q4

2000-Q2

];

View solution in original post

5 Replies
swuehl
MVP
MVP

Doesn't

=MaxString(QuarterField)

return the latest quarter?

But it might be good to interpret your values as duals, so you can use Date /Time functions on them.

edit: Interpreting like

LOAD *,

Dual(Quarter, QuarterStart(Makedate(Left(Quarter,4)),Right(Quarter,1)-1)) as QuarterDual

INLINE [

Quarter

2001-Q1

2002-Q4

2000-Q2

];

View solution in original post

Not applicable

wot ever you decide, always go back to your base unit as users are fickle, get it working @ the base unit, the rest should fall into place

balrajprabhu
Creator II
Creator II
Author

Thank you swuel, it works!

but the only problem is in the textbox it shows the numberic values I want to display as YYYY-Q

How can it be done

Is this the only way

=Date(max(QuarterDual),'YYYY')&'-Q'&ceil(month(max(QuarterDual))/3)

swuehl
MVP
MVP

Yes, keeping the text format of a dual value when e.g. using Max() might get annoying.

In your specific case, you should be able to use MaxString(Quarter) or MaxString(QuarterDual)

In other cases, you might need to reformat the value.

balrajprabhu
Creator II
Creator II
Author

Wow!,I never knew there about maxstring() function .