Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

MAX function

Hi all

I have a small problem getting the max function right.

I will like to do this in a table in QV:

=if (max (length, width, height) = length (then) 1 else (0) but I can not get it right.

And I need to do the same with median and min.

Anybody with a little help?

Best regards

Bjarne

1 Solution

Accepted Solutions
sridhar240784
Creator III
Creator III

Hi,

RangeMax function will help you to do this.

Your expression should be some thing like below.

IF(RangeMax(Length,Hieght,Width) = Length,1,0)

Check the attached application.

Hope this helps you.

-Sridhar

View solution in original post

9 Replies
lironbaram
Partner - Master III
Partner - Master III

can you explain a little bit more on the data structre

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Max() only takes a single expression (plus a rank) so I'm guessing you are looking more for:

IF(Length=Max(Length),1,0)

IF(Width=Max(Width),1,0)

IF(Height=Max(Height),1,0)

IF(Length=Median(Length),1,0)

IF(Width=Median(Width),1,0)

IF(Height=Median(Height),1,0)

IF(Length=Min(Length),1,0)

IF(Width=Min(Width),1,0)

IF(Height=Min(Height),1,0)

Is this what you were after?

Jason

Not applicable
Author

I'll try

I have an article 1234567 and the length of this collie is 40, the width is 30 and the height is 20. Then i'll check if the length is the highest value, if the width is the median and if the height is the smallest.

In excel i could like this. Length is in cell A1, width is in cell B1 and height is in cell C1

=if(max(A1:C1)=A1;1;0)

and the same for median

=if(median(A1:C1)=B1;1;0)

and for min

=if(min(A1:C1)=C1;1;0)

Not applicable
Author

Hey Jason

No not like that. Can I mabe use Maxstring? I need to compare length, width and height to ensure that length has the higest value and that the height has the smallest value

sridhar240784
Creator III
Creator III

Hi,

RangeMax function will help you to do this.

Your expression should be some thing like below.

IF(RangeMax(Length,Hieght,Width) = Length,1,0)

Check the attached application.

Hope this helps you.

-Sridhar

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Look at RangeMax() then.

Not applicable
Author

Hi Sridhar

Thank you a lot. But what can I do with Median then? Need to do the same, but no functionname called RangeMedian. Do you know the answer here also?

sridhar240784
Creator III
Creator III

Hi,

I have tweaked the table a bit to achieve your requirement. I have loaded the Length, height, Width as Measure in one column.

Now we can use Max and Median to solve you scenario.

I have a look at the attached application.

-Sridhar

Not applicable
Author

Thanks for the help

The Median I solve by this formula

=if(DCU.Length=RangeMax(DCU.Length,DCU.Width,DCU.Height)and(DCU.Height=RangeMin(DCU.Length,DCU.Width,DCU.Height)),1,0)