Announcements
Sept. 27, 10AM ET Do more with Qlik, Insight Advisor – our intelligent AI-assistant in Qlik Sense: Register
cancel
Showing results for
Did you mean:
Creator

## Max Value of a Field (Not all data in the dataset; Just one cell

Let's say I have this table

Import:
[
duration
()
(03,238,09,)
(10,361,04,)
(163)
(116)
(04,172,07,)

];

Dataset:
NoConcatenate
//Max(duration) as MaxValue
Resident Import;

DROP Table Import;

I want the table to look like this:

 duration MaxValue () 0 (03,238,09,) 238 (10,361,04,) 361 (163) 163 (116) 116 (04,172,07,) 172

How do I find the max value of a string of one cell? Not the entire set of data. I have tried Max() and MaxString() but as you know, it finds the Max of the entire data set for that field.

Labels (1)
• ### General Question

1 Solution

Accepted Solutions
MVP

If you have few values in the same cell you can use subfield

RANGEMAX(
SUBFIELD(PurgeChar(duration, '()'), ',', 1),
SUBFIELD(PurgeChar(duration, '()'), ',', 2),
SUBFIELD(PurgeChar(duration, '()'), ',', 3)
)

2 Replies
MVP

If you have few values in the same cell you can use subfield

RANGEMAX(
SUBFIELD(PurgeChar(duration, '()'), ',', 1),
SUBFIELD(PurgeChar(duration, '()'), ',', 2),
SUBFIELD(PurgeChar(duration, '()'), ',', 3)
)

Creator III

@mp802377 wrote:

Let's say I have this table

Import:
[
duration
()
(03,238,09,)
(10,361,04,)
(163)
(116)
(04,172,07,)

];

Dataset:
NoConcatenate
//Max(duration) as MaxValue
Resident Import;

DROP Table Import;

I want the table to look like this:

 duration MaxValue () 0 (03,238,09,) 238 (10,361,04,) 361 (163) 163 (116) 116 (04,172,07,) 172

How do I find the max value of a string of one cell? Not the entire set of data. I have tried Max() and MaxString() but as you know, it finds the Max of the entire data set for that field.

The max function works based on the group by clause at the end, if you have a column against which you need to find out the max value. Also, the above syntax seems to be incomplete without the group by clause, and after getting the max value you can right join the data against which you need to get the data.

For example