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
Anonymous
Not applicable

Duration.days returning false values (Power Query)

Hello Everyone, 

 

I am using duration.days to calculate the duration between two dates. But the result is sometimes right and sometimes wrong. 

For example between 28/04/2020 and 04/05/2020 it should returns 7, it returns 6

And between 05/05/2020 and 06/05/2020 it returns the correct result which is 1.

 

 

9 REPLIES 9
Anonymous
Not applicable

yja_0-1671020269897.png

Still showing 6 instead of 7

because of 28/04/2020 is excluding it is not including.

 

Anonymous
Not applicable

yja_0-1671020632089.png

I don't think so, because it gives correct results for other dates, like 04/05/2020 and 07/05/2020. it returns 3

it gives correct results for other dates, like 04/05/2020 and 07/05/2020. it returns 3 , YES because 04/05/2020 is excluding and 07/05/2020 is including i.e (05/05/2020,06/05/2020,07/05/2020) , you should count other dates day.


https://youtu.be/4ys32MS3uqI

Anonymous
Not applicable

How can i correct this then ?

Anonymous
Not applicable

Should i add 1 to the result?

No @Anonymous  ,because if you add 1 so  in this scenario05/05/2020 and 06/05/2020 it returns the correct result which is 1 answer will be wrong.

Anonymous
Not applicable

Then should i just leave it like this?

Mahesh0016
Super User
Super User

Go To >> Power Query >> Select first date then Select subtract date column >> Add column tab >> from Date & time >> Date drop down >> click subtract day >> you got your answer correct.

Mahesh0016_1-1671019320099.png

Mahesh0016_0-1671019555592.png

>>first date is exluding it is not including.

 

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors