12 Replies Latest reply: Dec 30, 2015 7:53 AM by sebastian londono

# Get Max of a possible list selection

Hi everyone

I need to get the Max in a possible list.

Something like this:

I need to get that '46' and put in into my set analysis. In this case is 46 but there may be other cases in which is other number.

(In Orange the important)

Tried this too: vMaxWeek = Max(Empleado.Semana) ....This get the '46' but when i put it into the set analysis it doesnt work

Any idea?

• ###### Re: Get Max of a possible list selection

Try this:

• ###### Re: Get Max of a possible list selection

Not Working :s

• ###### Re: Get Max of a possible list selection

• ###### Re: Get Max of a possible list selection

Not Working

• ###### Re: Get Max of a possible list selection

• ###### Re: Get Max of a possible list selection

Not working

• ###### Re: Get Max of a possible list selection

Not working is not very helpful...

Do you get a correct value when you input the 46 as constant:

I wonder if you really want to sum a constant 1 here. What do you get returned (e.g. when using

)?

Could you upload a small sample QVW and your requested result?

• ###### Re: Get Max of a possible list selection

Hi, You're rigth, "not working" is not helpful.

Look, This is the result I should get.

The idea is to show the position of a person when it leaves the company. in this case a person had a position "EQ. ATENC.CLIENTES ..." from week 1 through week 44, then changed his position and went on to "dept. CANALAES FACE .." in week 45 and 46. This person left the company at week 46 (the last record). Then I need only the first record of the original image.

Here the link to the test.qwv: test.qvw

• ###### Re: Get Max of a possible list selection

First of all, what is the expression used for vMaxWeek

1. =MAX(Week)
2. MAX(Week)

When the variable expression is 1 use Empleado.Semana={\$(vMaxWeek)}

When the variable expression is 2 use Empleado.Semana={\$(=\$(vMaxWeek))}

This is because the first is already evaluated and is 46, the second contains only the logic and has to be evaluated.

Also if you don't set the label of a expression you can read the outcome of the statement. Very usefull if you use several variables and youre not sure if the syntax is correct.

Also like swuehl states, please share what does work, and what you've tested.

• ###### Re: Get Max of a possible list selection

So much thanks.

I just chage the variable from Max(Week) to =Max(Week) and is working correctly.

Both Working:

When the variable expression is 1 use Empleado.Semana={\$(vMaxWeek)}

When the variable expression is 2 use Empleado.Semana={\$(=\$(vMaxWeek))}

Thanks to all.

• ###### Re: Get Max of a possible list selection

Didn't I already give you the second expression above? -> Re: Get Max of a possible list selection

• ###### Re: Get Max of a possible list selection

Absolutely

But it was necesary to adjust the variable putting "=" before the expression.