Qlik Community

Ask a Question

App Development

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

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
fasuhaibani
Contributor III
Contributor III

How to Use Mid with Min Function

Hello Everyone!

So I have this field which contains a code and within that code there is a year (e.g. XXYYYYZZZZZ, where YYYY represents the year).

So what I would like to do is to get the minimum year after extracting it from that field. I have tried the following:

Min(Mid(Code, 3, 4))

Min(aggr(Mid(Code, 3, 4), ID))


But it doesn't work.


Your help is appreciated.

1 Solution

Accepted Solutions
marcus_sommer
MVP & Luminary
MVP & Luminary

With these informations it's quite difficult to say what didn't worked like expected. Maybe it's easier to extract this within the script:

Num(Mid(Code, 3, 4)) as CodeYear

Are the other code-parts not numeric you could also use: keepchar(Code, '0123456789'). And then should be a min() or a firstsortedvalue() expression within the charts simpler.

- Marcus

View solution in original post

3 Replies
marcus_sommer
MVP & Luminary
MVP & Luminary

With these informations it's quite difficult to say what didn't worked like expected. Maybe it's easier to extract this within the script:

Num(Mid(Code, 3, 4)) as CodeYear

Are the other code-parts not numeric you could also use: keepchar(Code, '0123456789'). And then should be a min() or a firstsortedvalue() expression within the charts simpler.

- Marcus

View solution in original post

sunny_talwar

Where exactly are you trying to do this? In the script? In an expression may be like this

Min(Year(Date#(Mid(Code, 3, 4), 'YYYY')))

fasuhaibani
Contributor III
Contributor III
Author

Sorry didn't work.