Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Calculate days between completion date and today with error for blanks

Hello
 
I'm trying to work out the days between 2 dates and have an error for blanks. 
 
Currently I'm using this which calculates between the expiry date and today. 
Expired days = value(TODAY()) - value('learning obj'[Actual Expiry Date])
 
This works fine until the expiry date is blank. How can I add in so that if its got no expiry date it says no expiry date instead?
 
 
1 ACCEPTED SOLUTION
Mohammad_Refaei
Solution Specialist
Solution Specialist

I assume you are using a calculated column not a measure and it will be difficult to have different data types like numerical figures and text values. I would return a standard value in response to blank expiry date like 99999.

Expiry Days =
IF (
    'learning obj'[Actual Expiry Date] = BLANK (),
    99999,
    TODAY () - 'learning obj'[Actual Expiry Date]
)

 

if you are ok with storing the days in text format then you can use a formula like this:

Expiry Days =
IF (
    'learning obj'[Actual Expiry Date] = BLANK (),
    "No Expiry Date",
    FORMAT ( TODAY () - 'learning obj'[Actual Expiry Date], 0 )
)

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Work perfectly. 

 

Thank you 🙂 

Mohammad_Refaei
Solution Specialist
Solution Specialist

I assume you are using a calculated column not a measure and it will be difficult to have different data types like numerical figures and text values. I would return a standard value in response to blank expiry date like 99999.

Expiry Days =
IF (
    'learning obj'[Actual Expiry Date] = BLANK (),
    99999,
    TODAY () - 'learning obj'[Actual Expiry Date]
)

 

if you are ok with storing the days in text format then you can use a formula like this:

Expiry Days =
IF (
    'learning obj'[Actual Expiry Date] = BLANK (),
    "No Expiry Date",
    FORMAT ( TODAY () - 'learning obj'[Actual Expiry Date], 0 )
)

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.