Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am looking for help with a formula that will look at two date/time columns and use the earlier time.
For example, when calculating the length of stay, it is currently only using the registration date/time (because ideally this is earlier than triage date/time, but not always the case) and caluculating with the discharge date/time to produce the length of stay.
I now want the formula to consider the Triage Date/Time and the Registration Date/Time and decipher which date/time is earlier and use that to then calculate the length of stay of the patient. Is this possible?
Here is a screenshot of some sample data:
Thanks in advance!
could you pls provide some sample data (not the screenshot)? and what's the expected output based on the sample data you provided?
Proud to be a Super User!
This SWITCH Statement should get you there:
LengthofStay = SWITCH(
TRUE(),
[Registration Date/Time] < [Triage Date/Time], [Discharge Date/Time] - [Registration Date/Time],
[Discharge Date/Time] - [Triage Date/Time] ).
Basically an If statement to determine which is earlier.
Hope this helps.
Regards,
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!