Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to combine two fields

Hi

I have a table called "Invocies" in which I have 2 fields, one is INVOICE DATE and another is  ORDER DATE.  I want to combined the dates and have one field called DATE

Below is the  part of the scripting I've done to combine the dates.

Invoices:

LOAD *,

INVDATE as DATE,

ORDDATE as DATE

However I get the following error - "Filed names must be unique with table"

Where am i going wrong in my scripting.  Please can you help.

kind regards

Nayan

7 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can't give two fields the same name. That would make it impossible to know from which field the value should be extracted.

Putting INVDATE and ORDDATE in one field doesn't make sense to me since they are very different things. But if you feel you must you then you need to do something like

Invoices:

LOAD *, INVDATE as DATE from ....etc;

LOAD *, ORDDATE as DATE from .... etc;

That will cause every invoice record to occur twice in the invoices table; once with INVDATE as DATE and once with ORDDATE as DATE. This sounds like a bad idea.

You should probably read this discussion about using common date dimensions and shared calendars.


talk is cheap, supply exceeds demand
Not applicable
Author

Invoices:

LOAD *,

INVDATE as DATE

outer join

ORDDATE as DATE

Not applicable
Author

If u simply need to comine two date fields u can also go with concatente.  Otherwise try wat Gysbert has suggested......it shud work

Not applicable
Author

Hi Gysbert

Thank you.  What im trying to achieve in the front end , i want to see the value of invoices or orders per day in one table, by selecting only one date, in this case its DATE (see table below)

Will it be easier to do it on the front end

DATEOrder ValueInvoiced Value
20121031200,000150,000
20121030500,000600,000
201210293,300,0004,000,000
2012102750,00080,000
2012102690,000100,000

kind regards

Nayan

Not applicable
Author

Invoices:

LOAD *,

INVDATE as DATE,InvoiceValue from ...

outer join

ORDDATE as DATE,OrderValue from ...

or

U can have seperate tables

Invoices:

LOAD *,

INVDATE as DATE,InvoiceValue from ...

Orders:

ORDDATE as DATE,OrderValue from....

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I thought this discussion looked familiar. Did you follow Miguels advice? You should be all set to go then. Your combined  table with orders and invoices will already have a DATE field, as well as the OrderDate and InvoiceDate fields. If you haven't followed his advice yet, do so now.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi

I wil try it.  Thank you for your help.

kind regards

Nayan