cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CloudMonkey Member
Member

Query Editor / M code for subtracting one day

Hi,

 

I have the below code in M that gives the number of days between the start date and end date (it works fine):

[EndDate]-[StartDate]

 

But if I try to subtract "1" then I get an error:

[EndDate]-[StartDate]-1

 

I assume it's because [EndDate] and [StartDate] are stored as dates but "1" is an integar? Please do you know how to fix?

 

Thanks,

 

CM

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Query Editor / M code for subtracting one day

Replace 1 by: #duration(1,0,0,0)

 

Specializing in Power Query Formula Language (M)
1 REPLY 1
Super User
Super User

Re: Query Editor / M code for subtracting one day

Replace 1 by: #duration(1,0,0,0)

 

Specializing in Power Query Formula Language (M)