Skip to main content
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.

Not applicable

Date Difference with blank values


I'm new to Power BI, and I am encountering a problem with a MySQL database. 

I'd like to calculate a number of weeks between two dates, but my starting date column contains blank values. 

I tried : 

HowManyWeeks= IF(ISBLANK('mytable'[startdate],DATEDIFF(TODAY(),'mytable'[enddate],WEEK)),DATEDIFF('mytable'[startdate],'mytable'[enddate],WEEK))


but it says : "Cannot convert value 'NA' of type Text to type Date."

any idea on how do I fix that? 

thanks in advance! 


Not applicable

Datediff is  work with date type column, As i can the error is saying NA value is there in your one of the date column hence the data type of your column is  text.


It's data issue so clean your data.

Edit query -> remove that NA value or replace it with blank or specific date and change column type to date.

Apply & close.


The above dax will work.


Thanks & regards,
Pravin Wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Helpful resources

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


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.