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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Can someone help me with the formula to calculate no of days between two dates.

I am Trying to use Datediff to find out the number of days between two dates and I am getting this error

 

Days Between = DateDiff(table1[Date1], table1[Date2], Day)

 

A single value for column 'WoW' in table 'Table Current' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Do Date1 and Date2 belong to the same table?

If yes, you can Subtract Days in Power Query Editor.

Select the two columns and click Subtract Days.

 

can1.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

9 REPLIES 9
Anand24
Super User
Super User

Hi @Anonymous ,

 

Try to have this same formula for New Column instead of new measure.

 

If you are using measure, try this:

Days Between = DateDiff(MAX(table1[Date1]), MAX(table1[Date2]), Day)

 

Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!

Anonymous
Not applicable

Hi @Anand24,

Usin this formula I am getting same value for all the rows.

@Anonymous  ,

What are you trying to calculate the dates against? What is the category here?

Your date fields are returning multiple values and that's the main reason why you are not getting appropriate result.

 

Can you provide some data and show what is the expected output?

Anonymous
Not applicable

@Anand24 

 

Date1

2017-10-17
2017-12-21
2017-12-23
2018-01-11
2018-03-17
2018-02-08
2018-03-03
2018-10-02
2018-12-16
2019-08-16
2019-07-31
2019-08-16
2019-07-31
2019-08-15
2019-08-30

 

 

Date 2

01/16/2018
03/15/2018
03/16/2018
04/18/2018
06/18/2018
08/14/2018
08/14/2018
12/17/2018
02/15/2019
10/16/2019
10/16/2019
10/17/2019

Hi @Anonymous ,

 

Do Date1 and Date2 belong to the same table?

If yes, you can Subtract Days in Power Query Editor.

Select the two columns and click Subtract Days.

 

can1.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

lkalawski
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

Could you share more details? What means 'WoW' column? What do you have in this column?

Can you send a sample of data?



_______________
If I helped, please accept the solution and give kudos! 😀

Anonymous
Not applicable

@lkalawski 

I am trying to calculate days between two dates using

Days Between = DateDiff(table1[Date1],table1[Date2], Day)

kaushik_asv
Frequent Visitor

Are you trying to use this as a measure? If yes, try adding this as a column or a calculated column. It should help with this error. It did the trick for me not too long ago. 

Anonymous
Not applicable

@kaushik_asv 

Well, I tried adding a column, used the same formula and still I am getting the same error. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.