Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Black_Hole
Creator II
Creator II

Comparing two fields in Load Statement

Hello all,

I compare two fields in a load statement. But, the result is not correct.

Below the detail of my script and in the attached file the output this script :

[Temp_1]:
LOAD DISTINCT
              Item_No,
             IF(NewTaux2<(OldRatio*100), OldRatio*100 & '%', NewTaux2) As NewRatio
RESIDENT Temp_0;

Please could you tell me what's wrong in my script.

Thank you in advance for your help.

 

Labels (2)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

 Try

num(rangemax(NewTaux2,OldRatio), '0%')  As NewRatio

View solution in original post

4 Replies
Vegar
MVP
MVP

Temp_1:
LOAD DISTINCT
              Item_No,
             IF(NewTaux2<(OldRatio*100), OldRatio*100 & '%', NewTaux2) As NewRatio
Inline [

Item no, NewTaux2, OldRatio

51256, 90% ,0.2];

 

You are getting the correct output as I see it.

If (90%<20, 20%, 90%) should return 20%

 

Please explain your desired result. 

Black_Hole
Creator II
Creator II
Author

Hello @Vegar ,

Thank you for your reply.

My purpose is to return the upper value between NewTaux2 and OldRatio.

So, if NewTaux2 is upper than OldRatio then NewRatio is equal to NewTaux2.

Else, that's mean that NewTaux2 is lower than OldRatio and per consequent NewRatio is equal to OldRatio.

Please how can I modify my expression in order to return the result describe above.

Thank you in advance for your help.

Vegar
MVP
MVP

 Try

num(rangemax(NewTaux2,OldRatio), '0%')  As NewRatio

Black_Hole
Creator II
Creator II
Author

Re,

Try it and this works perfectly 👍

Many thanks for your help !