I am attempting to build a look showing average client lifespan.
The applicable dimensions are
It’s been fairly straightforward to create a calculation to count diff_days between either the admission date and now() or admission date and discharge date, but I’m struggling to bridge the gap and create one calculation that can count diff_days between admission date and now (if discharge date is null) AND admission date and discharge date (if discharge date is not null).
What is the best approach to accomplish this? I’m still learning SQL, so any help would be appreciated. Thanks!!