Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
megasupermoon
Contributor III
Contributor III

Calculate number of days between start and end dates with a twist

Hey,

I have Qlik sense report which shows number of treatment days between end and start dates in different departments. There can be many rows for one department. They are counted in sql query:

DATEDIFF
( DAY,
  START_DATE,
  ISNULL(END_DATE, GETDATE())
) AS NET_TREATMENT_DAYS

and then in front-end expression: Sum(NET_TREATMENT_DAYS).

But now I need gross treatment days (gross treatment days  are calculated:  END_DATE - START_DATE + 1. Therefore START_DATE and END_DATE is included.)

Any idea how to calculate this? Is it possible to calculate in front-end, or should I do that in sql query or in load script etc and how?

Thanks in advance!

1 Solution

Accepted Solutions
megasupermoon
Contributor III
Contributor III
Author

Hey,

I figured out how to do this.

I got right numbers with front-end expression 

Sum(NET_TREATMENT_DAYS + 1)

 

View solution in original post

2 Replies
megasupermoon
Contributor III
Contributor III
Author

Could

Sum(NET_TREATMENT_DAYS) + Count(END_DATE)

make a trick?

megasupermoon
Contributor III
Contributor III
Author

Hey,

I figured out how to do this.

I got right numbers with front-end expression 

Sum(NET_TREATMENT_DAYS + 1)