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

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.

Reply
Anonymous
Not applicable

Date Difference with blank values

Hi, 

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! 

 

1 REPLY 1
Anonymous
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
www.linkedin.com/in/pravin-p-wattamwar

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors