Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Comparing values and choosing the smaller value?

Hello guys,

So I have following Problem: i Need qlikview to look at two different rows from my data source and compare the values within. For further calculations in qlikview I Need it to find out the smaller number and hold it as a value for for example a new variable.

I apreciate every small hint, tip and help

If so far something isnt clear enough to you please just ask me to clarify

Kind regards,

Max

17 Replies
YoussefBelloum
Champion
Champion

Hi,

for your first request: "Need qlikview to look at two different rows from my data source and compare the values within"


what are the rows that you want to look into ?


for your second request: "I Need it to find out the smaller number and hold it as a value for for example a new variable."


where want to do it ? on the script or on the front end ?

vishsaggi
Champion III
Champion III

Can you share some sample data and your expected output please?

Anonymous
Not applicable
Author

Hello Youssef,

Thank you very much for your fast Reply.

1.) These two rows are within my LOAD Document, which is an Excel table

2. I dont really care where I can implement it, as Long as it works it doesnt matter. However, it maybe usefull to know that the data source im using is significantly large and that a filter machanism is up front to filter the needed rows from the selected peer.

Thank you very much

Kind regards, max

Anonymous
Not applicable
Author

First of all thank you for your fast reply

Im not allowed to give out any data, however, I can give you a Simulation:

so the data source are 2 rows from an Excel sheet with numbers in it looking as following: 620 or -450 ore what so ever.

in this example case the Output would Need to look like -450 however, I would also Need to convert the Output into a positive number and the final Output would be 450 in this case

Kind regards,

max

YoussefBelloum
Champion
Champion

so maybe you mean: Need qlikview to look at two different COLUMNS from my data source and compare the values within ?


would you be able to describe the expected output after the comparison ?

Anonymous
Not applicable
Author

Yes excuse me, I mixed Things up.

so the Input data would look for example like

300      /          45

-250     /         2000

-634     /         -4

...

and the Output would Need to look like:

0

-250

-634

I Need it to Hand out the smaller number or if there is no number smaller than 0, a Zero as Output

after this I Need to turn the Output positive, what should be possible with a FABS(x) Formula

niclaz79
Partner - Creator III
Partner - Creator III

RangeMin(column1,column2)

YoussefBelloum
Champion
Champion

try this on the script:

table:

LOAD * Inline [

column1,column2

300,45

-250,2000

-634,-4

];

table1:

LOAD

if(column1>=0 and column2>=0,0, if(column1<column2,column1,if(column2<column1, column2))) as final

Resident table;

PFA

balabhaskarqlik

May be like this:

Input:

Load

ID,

ID1

from ABC;

Noconcatenate

Temp:

Load

if(Previous(ID) < ID, num(fabs(Previous(ID)),(#,##.0)),num(fabs(ID),(#,##.0))) as IDNew,

if(Previous(ID1) < ID1, num(fabs(Previous(ID1)),(#,##.0)),num(fabs(ID1),(#,##.0))) as ID1New

resident Input;

Drop table Input;

In Expressions:

num(Previous(ID1),#,##.0;(#,##.0)).