Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
pgloc2020
Creator
Creator

How to Calculate the difference between two dates appear in 2 different tables in qlik sense

Hello,

I have 2 different data sets -"Open_claims" and "Closed_claims" . I need to calculate the difference between the claims that are opened that week - claims that are closed that week. 

I need to display data on a weekly basis. 

I have calculated the overall difference between the open and closed claims using the following expression-

Count(Open_claim.App_ID) - Count([Closed_claim.App_ID])

But I need to create a table chart and want to display this difference on weekly basis as shown below.

pgloc2020_0-1651235367281.png

Please help me how to achieve desired result. Do I have to manually select same date range from both data sets to get the difference between open and closed claims for that week?

Columns in Open_Claim table are - App_ID, Open_Date, App_Type

Columns in Closed_Claim table are - App_ID, Closed_Date, App_Type

There is no common key to join the tables.

Format of the date is MM/DD/YYYY

Thank you in advance

Labels (1)
1 Solution

Accepted Solutions
vchuprina
Specialist
Specialist

Hi,

You can use the WeekEnd function, as an example

Table:
LOAD
     Date,
     WeekEnd(Date(Date#(Date,'MM/DD/YYYY'))) as weekend
     ;
LOAD * Inline [
Date,
4/29/2022
4/22/2022
];

Result:

vchuprina_0-1651241709814.png

With this function, you can create a weekend field in both tables and use it as a link between tables

WeekEnd(Date(Date#(Open_Date,'MM/DD/YYYY'))) as weekend

WeekEnd(Date(Date#(Closed_Date,'MM/DD/YYYY'))) as weekend

 

Regards,

Vitalii


 

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").

View solution in original post

3 Replies
vchuprina
Specialist
Specialist

Hi,

You can use the WeekEnd function, as an example

Table:
LOAD
     Date,
     WeekEnd(Date(Date#(Date,'MM/DD/YYYY'))) as weekend
     ;
LOAD * Inline [
Date,
4/29/2022
4/22/2022
];

Result:

vchuprina_0-1651241709814.png

With this function, you can create a weekend field in both tables and use it as a link between tables

WeekEnd(Date(Date#(Open_Date,'MM/DD/YYYY'))) as weekend

WeekEnd(Date(Date#(Closed_Date,'MM/DD/YYYY'))) as weekend

 

Regards,

Vitalii


 

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
vchuprina
Specialist
Specialist

Your Data model will look like this:

vchuprina_0-1651242225127.png

Regards,

Vitalii

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
pgloc2020
Creator
Creator
Author

Thank you Vitalii,

It works as you suggested.