Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
raadwiptec
Creator II
Creator II

max

I have Data from 2Files

File1

Sales ID | Sales Amount

1| 100

2| 200

 

File2

Sales ID | Budget Amount

1| 170

2| 290

 

I Want to pick the Max of (Sales amount and Budget amount) and put it in a new field . need to perform this on the Load script..

For Ex:  Sales ID | Sales Amount| Budget Amount|MaxCheck

                    1| 100|170|170

Labels (1)
2 Replies
JGMDataAnalysis
Creator III
Creator III

Something like this?

Temp:
NOCONCATENATE
LOAD * // Data from File1
INLINE [
        Sales ID, Sales Amount
        1,        100
        2,        200
];

JOIN (Temp)
LOAD * // Data from File2
INLINE [
        Sales ID, Budget Amount
        1, 	  170
        2, 	  290
];

Final:
NOCONCATENATE
LOAD *,
     RangeMax([Sales Amount], [Budget Amount]) AS MaxCheck
RESIDENT Temp
;

DROP TABLE Temp;
raadwiptec
Creator II
Creator II
Author

When Iam running this to the whole data set i dont get the correct Rangemax results.. But when i using it in expression it works

For Ex: when running in script

Sales ID | Sales Amount| Budget Amount|MaxCheck

                    1| 100,987|187,654|190,356

 

when using in expression it works correct

Sales ID | Sales Amount| Budget Amount|MaxCheck

                    1| 100,987|187,654|187,654

 

But as i need this in load script.. as the file too huge and i would like store it in specific folder