
Contributor III
2023-06-01
11:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
Labels (7)
Labels
- Subscribe by Topic:
-
Data Load Editor
-
dimension
-
expression
-
General Question
-
Set Analysis
-
Variables
-
Visualization
806 Views
1 Solution
Accepted Solutions

Contributor III
2023-06-02
07:02 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
I figured out how to do this.
I got right numbers with front-end expression
Sum(NET_TREATMENT_DAYS + 1)
778 Views
2 Replies

Contributor III
2023-06-01
02:46 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could
Sum(NET_TREATMENT_DAYS) + Count(END_DATE)
make a trick?
786 Views

Contributor III
2023-06-02
07:02 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
I figured out how to do this.
I got right numbers with front-end expression
Sum(NET_TREATMENT_DAYS + 1)
779 Views
