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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
patricPBI
Helper I
Helper I

DateDiff only works with measure and does not recognize columns

Hi, 

 

As many others here, I would like to get the count difference of two dates. 

I have one column called "closed dates" and another column called "Opened Dates"

 

When I try to do the "duration.day" formular in the query editor, the outcome only shows me errors. 

When I try to do a dax measure with DateDiff it only allows me to select measures from that data table, but not simple columns. 

 

My two date columns are categorized as "Date" so that cannot be the problem. 

 

Is there a way to use the DateDiff function with normal date columns?

1 ACCEPTED SOLUTION

Hi @patricPBI ,

You have got extra COMMA for MAX function. Remove them please as highlighted below:

Pragati11_0-1600949634608.png

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

8 REPLIES 8
Pragati11
Super User
Super User

Hi @patricPBI ,

 

Try a DAX measure something like this:

 

Diff = DATEDIFF(MAX(Date1), MAX(Date2), Month)

 

  1. Modify MAX to other summarisation as required.
  2. Replace Date1 and Date2 with your actual column names.

For details on DATEDIFF, refer following link:

https://docs.microsoft.com/en-us/dax/datediff-function-dax

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi @Pragati11 ,

UNfortunetely, I get the following error message:

patricPBI_0-1600943448897.png

Also, for MAX, it is asking me fo a Scalar 2. What do I have to input here?

Best regards,

Patric

HI @patricPBI ,

 

Unfortunately, just the screesnhot of your error doesn't help.

Share screesnshot of the measure you are writing.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11

patricPBI_0-1600943824143.png

What do I have to state where the "??" are?

Hello @patricPBI ,

The MAX function takes only one argument.

Check my DAX again.

Thank you

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

HI @Pragati11

patricPBI_0-1600946927278.png

It tells me that I cannot have just one argument for he MAX function

Hi @patricPBI ,

You have got extra COMMA for MAX function. Remove them please as highlighted below:

Pragati11_0-1600949634608.png

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

thanks a lot @Pragati11 

 

That was indeed the mistake. 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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