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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors