Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Re: Create flag expression from different tables

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

Re: Create flag expression from different tables

I get an error when I reload the script

Not applicable

Re: Create flag expression from different tables

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

Not applicable

Re: Create flag expression from different tables

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

Re: Create flag expression from different tables

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

Not applicable

Re: Create flag expression from different tables

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

Re: Create flag expression from different tables

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

Re: Create flag expression from different tables

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

Community Browser