Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

max value out from 3 straight table columns

I have straight table with 3 columns with diff scenario values... i need to find out the Max value out of 3 values. its a max of absolute numbers however i need to retain the sign .

  

Scenario-1Scenario-1Scenario-1Max(Scenario)
120-212-830-830
-388990113990
-78793188-787
6 Replies
Chanty4u
MVP
MVP

try

=FirstSortedValue(Senario,- Value)

Anil_Babu_Samineni

Perhaps This.

=FirstSortedValue(Max(Expression), Dim)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Or
MVP
MVP

There may be cleaner ways to do this, but this should work:

NumMax(fabs(Column(1),fabs(Column(2),fabs(Column(3)) *

If(NumMax(Column(1),Column(2),Column(3)) = NumMax(fabs(Column(1),fabs(Column(2),fabs(Column(3)),1,-1)

Explanation: First, we find the maximum absolute value.

Second, we check if this value is equal to the maximum non-absolute value. If it is, then it was a positive number (multiply by 1). If it isn't, then it was a negative number and we need to multiply by -1 to reverse the sign.

effinty2112
Master
Master

Dear Udaya,

                    This perhaps?:

Data:

LOAD * INLINE [

    Scenario, Value

    1, 120

    1, -212

    1, -830

    2, -388

    2, 990

    2, 113

    3, -787

    3, 93

    3, 188

];

Then

Scenario FirstSortedValue(Value,-Fabs(Value))
990
1-830
2990
3-787

Cheers

Andrew

HirisH_V7
Master
Master

Hi,

May be like this,

Max values of three columns-231094.PNG

Using this expression,

=Sum(IF(fabs([Scenario-3])>fabs([Scenario-1]) and fabs([Scenario-2]),[Scenario-3],

IF(fabs([Scenario-1])>fabs([Scenario-2]) and fabs([Scenario-3]),[Scenario-1],

IF(fabs([Scenario-2])>fabs([Scenario-1]) and fabs([Scenario-3]),[Scenario-2]))))

Hope this helps,

PFA,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

Thank you everyone with valuable inputs. I had similar idea what Shoham had suggested, until we have clear solution i am going to make use of this expression. its working...thank you everyone!