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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Kasiop
Helper II
Helper II

Date issue

Hi,
 
Here is my issue:
I am trying to get the difference between two dates (I am using a direct query view), but on PBI desktop, I don’t see my fields as date format:

test.JPG

If anyone has any idea on why I cannot use the dateDiff or why I cannot see the date format for my two fields I will be more than happy.

 

thanks,

Naïma

 

6 REPLIES 6
v-xicai
Community Support
Community Support

Hi @Kasiop ,

 

You may select on the column [Closure Date], go to Column tools->Data type, change the data type to Date, do the same with column [Creation Date]. Then you may create measure instead of calculated column like DAX below.

 

Measure= DATEDIFF(MAX(Table1[Creation Date]),MAX(Table1[Closure Date]),DAY)

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Amy, but it is "kind of" a format date already but I still cannot use the Dax measure: 

Kasiop_0-1598535863695.png

 

 

 

v-xicai
Community Support
Community Support

Hi @Kasiop ,

 

Based on my test which connect to SQL Server database using DirectQuery Mode in the latest version of Power BI Desktop, the DATEDIFF function works well.

 

 

DateDiff = DATEDIFF(MAX(Sales[CreationDate]),MAX(Sales[ClosureDate]),DAY)

 

 

184.png

 

>>Thanks Amy, but it is "kind of" a format date already but I still cannot use the Dax measure: 

 

Is there any error message to appear when you create this measure?

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@Kasiop - What happens if you do this:

 

Measure = (MAX([Closure Date]) - MAX([Creation Date])) * 1.

 

?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks, it returns -40 does it mean I use this formula?

Hi,

after applying the formul, i am not sure the outcome is right... if you have another idea... that will be great.

Thanks

Kasiop_0-1598344713391.png

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.