Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

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

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

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')))

Anonymous
Not applicable
Author

Sorry didn't work.