Skip to main content
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER

How to use - MaxString & MinString

cancel
Showing results for 
Search instead for 
Did you mean: 
robert_mika
Master III
Master III

How to use - MaxString & MinString

Last Update:

Mar 1, 2015 2:48:19 PM

Updated By:

robert_mika

Created date:

Mar 1, 2015 2:48:19 PM

Attachments

Bullet points:

  • MaxString and MinString belongs to Qlikview String Aggregation function.
  • They are equivalent to MAX and MIN for integers
  • They return the highest and lowest string value

What actually a value of a string?

This is the value described by ANSI character standard where 0 ( NULL) is equal  to 0 and ÿ to 255.

(For full ANSI character set please attached dosument)

Taking only the standard English alphabet (A-z)  ‘A’ will be the MIN and ‘z’ will be the MAX.

Remember:

In ANSI standard A < a and Z < z

(A=65,Z=90,a=97,z=122)

Language specific characters will be not recognized in the place where they are in your alphabet but they will be 'pushed' to the end

(see ANSI table)

MinString and MaxString works on dimensions (columns) only so you cannot use is to evaluate single character or strings .

(MaxString(‘a’,’z’…) is not supported

Examples:

1)    MIN & MAX (textbox)

DataExpressionResults

MinString(Category)

MaxString(Category)

2) MIN and MAX of String per group (Straight table)

DataExpressionResult

MinString(Category)



MaxString(Category)


3) With condition:

Return Max and Min string based on another column

We are looking for MIN and MAX string value from column Category where Country='Poland'

DataExpressionSolutionResult



MinString( if(Country='Poland', Category, null()) )





MaxString( if(Country='Poland', Category, null()) )

4) With LEFT/RIGHT

When used with LEFT the result will be the same as without as the value will be still based on first characters.

DataExpressionSolutionResult


=MinString( Right(Country,1))

=MaxString( Right(Country,1))

5) With MID

DataExpressionSolutionResult


=MinString( Mid(Country,2,2))





=MaxString( Mid(Country,2,2))

6) With Substring

When our data are little scrambled -TextBetween will return string between '.' and end of the row.

DataExpressionResult


=MinString(TextBetween(Country,'.','',1))



=MaxString(TextBetween(Country,'.','',1))

7) In set analysis

When Criteria of Sales is 2 return Country with highest and lowest string Value


DataExpressionResult



=MinString({<Sales={2}>} Country)





=MaxString({<Sales={2}>} Country)

😎 With Aggr()


For each Country return lowest and highest Category string value.

DataExpressionResult

=Aggr(Minstring(Category),Country)



=Aggr(Maxstring(Category),Country)

If know about other ways of using these functions please let me know.

Comments
nihhalmca
Specialist II
Specialist II

Very useful, thanks.

luiskeyrus
Partner - Contributor III
Partner - Contributor III

lik nihhalmca‌ very very useful!!!! ty

amita1621
Contributor III
Contributor III

I have a Period of format 4q 2017 and i want to go to 3q 2017 . by maxstring(period) i get 4q 2017 but how should i reach to 3q 2017

Version history
Last update:
‎2015-03-01 02:48 PM
Updated by: