Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create flag expression from different tables

Hi, I have a field called Income that I load from E:\qlikview\data\document1.qvd. I also have a field called Expenses that I load from E:\qlikview\document2.qvd.

In the same script I want to create another field that acts as a flag if the Expenses surpass the Income. My script would go as follows:

LOAD: ...

           ...

           Income_Hotel as Income,

           ...

FROM: E:\qlikview\data\document1.qvd

LOAD: ...

           ...

           Expenses_Hotel as Income,

           ...

FROM: E:\qlikview\data\document2.qvd

/*

* Is there any way to do something like if(Expenses_Hotel>Income_Hotel, 1, 0)?

*/

8 Replies
Not applicable
Author

Hope it helps!

LOAD: ...

           ...

           Income_Hotel as Income,

           ...

FROM: E:\qlikview\data\document1.qvd

Load *,if(Expenses_Hotel>Income_Hotel, 1, 0) AS Flag;

LOAD: ...

           ...

           Expenses_Hotel as Income,

           ...

FROM: E:\qlikview\data\document2.qvd

Not applicable
Author

I get an error when I reload the script

Not applicable
Author

Could you please attach the application with sample data...

Not applicable
Author

I tried it again and I didn't get an error, but I cant't find Flag in dimensions, do you know where it gets stored?

Not applicable
Author

Could you please attach your script or attach sample application to help you out!

Not applicable
Author

I'd like to, but I'm still not too familiar with qlikview and I dont know how to do that (I'm also using personal edition, I don't know if that's a problem), I just know how to modify existing applications.

Sorry.

Not applicable
Author

Even if it is developed in presonal edition not a problem for me as I am using the licensed one. I will do the required thing and will attach the script.

Not applicable
Author

Hope it helps you now! Let me know if you have any questions!

LOAD: ...

           ...

           Income_Hotel as Income,

           ...

FROM: E:\qlikview\data\document1.qvd

LOAD: ...

           ...

           Expenses_Hotel as Income,

lookup( 'Income_Hotel', 'PrimaryKeyTable1', 'PrimaryKeyTable2', 'FirstTableName') AS Income1,

if(Expenses_Hotel > Income1,1,0) AS Flag

           ...

FROM: E:\qlikview\data\document2.qvd