Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
josecanalla
Creator
Creator

Filter by date when I have more than one table with date field

Hello, I have Qlik Sense.

I have a "Table A" which has a "date" field. Then, I have a "Table B" which has another "date" field.

I have to rename the date field of tables for prevent QlikSense linking two tables with the date field.

I want to choose a date and filter the data of the two tables. How can I do this?

Thanks!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

I don't see any reason why you can't use a single Date field. Or for that matter no reason why you can't concatenate the tables

Transactions:

LOAD

     ID,

     Income_Value

     Date,

     Month(Date) as Month,

     Year(Date) as Year

FROM

     Incomes

     ;

Concatenate (Transactions)

LOAD

     ID,

     Expense_value

     Date,

     Month(Date) as Month,

     Year(Date) as Year

FROM

     Expenses

     ;

Chart expressions:

Incomes: sum(Income_Value)

Expenses: sum(Expense_Value)


talk is cheap, supply exceeds demand

View solution in original post

10 Replies
Gysbert_Wassenaar

If you don't want the two tables linked using the date field then my guess is that there is another field that links the tables. Or perhaps they're linked via one or more other tables. Otherwise it wouldn't make sense not to use the date field to associate the tables. But if that's the case then any selection that filters table A will also filter table B since they are in some way linked. Filtering the date in both tables would result in only the intersection of the two tables, i.e only those records that are linked to each other and in both tables have the same date. I'm not sure this is what you want. Perhaps you can give an example with some fake example data to explain the data you're working with and the results you expect.


talk is cheap, supply exceeds demand
Vincenzo_Esposito

‌If those two date fields represent two different date (eg. Order date and shipped date) and you need to put both in your analysis, you want to use two differen master calendar. In that case you can find a nice article from here Henric here

josecanalla
Creator
Creator
Author

Hello Gysbert. The two tables are not linked. In table A I have the expenses of the company, and in the table B I have incomes. The two tables have their correspondent date, so I want to see the incomes and expenses for any month.

Thanks!

Gysbert_Wassenaar

If the two tables are not linked then I don't see any reason why you should use the date field to link them. Or simply concatenate the two tables into one table.


talk is cheap, supply exceeds demand
josecanalla
Creator
Creator
Author

Because in one table I have the expenses and in the other table I have the incomes. So I want to represent the total incomes and total expenses for any month in the same graph (for example).

Gysbert_Wassenaar

Yeah, so? Those are different fields aren't they? sum(Income) and sum(Expenses). So what's the problem?


talk is cheap, supply exceeds demand
josecanalla
Creator
Creator
Author

Here are my two tables:

Screenshot_2.jpg

In my load script in QlikSense I do MONTH(Date) AS INCOME_MONTH and YEAR(Date) AS INCOME_YEAR and the same for Expenses. I want to have only one control with months, and when I pick, for example, "January" I get the list of Incomes and the list of Expenses which date are in "January".

Thank you a lot!

Edit: the tables have more fields, I put only these for simplicity.

Gysbert_Wassenaar

I don't see any reason why you can't use a single Date field. Or for that matter no reason why you can't concatenate the tables

Transactions:

LOAD

     ID,

     Income_Value

     Date,

     Month(Date) as Month,

     Year(Date) as Year

FROM

     Incomes

     ;

Concatenate (Transactions)

LOAD

     ID,

     Expense_value

     Date,

     Month(Date) as Month,

     Year(Date) as Year

FROM

     Expenses

     ;

Chart expressions:

Incomes: sum(Income_Value)

Expenses: sum(Expense_Value)


talk is cheap, supply exceeds demand
josecanalla
Creator
Creator
Author

Because the two tables are indirectly linked, so I generate a circular reference. But I delete this link and can link them between dates.

Problem solved, thanks!