Forum Discussion
commited2020
3 years agoFrequent Visitor
Date Error in M query editor
Hello i keep getting this message: Expression.Error: We cannot apply operator - to types DateTime and Date. Details: Operator=- Left=1/1/2024 12:00:00 πμ Right=1/1/2016 Here is the code at M qu...
- 3 years ago
Yes, the answer is in this line which is dynamic for both start and end (one year back in time (-1), and end of this year:
Source = {Number.From(#date(Date.Year(DateTime.LocalNow()) - 1,01,01))..Number.From(#date(Date.Year(DateTime.LocalNow()),12,31))}You can set it relative to both start or end (-1 is -1 year).
Or with fixed start and dynamic end:Source = {Number.From(#date(2016,01,01))..Number.From(#date(Date.Year(DateTime.LocalNow()),12,31))}Or with fixed start and end:
Source = {Number.From(#date(2016,01,01))..Number.From(#date(2023,12,31))}
commited2020
3 years agoFrequent Visitor
First of all thank u for your response the code worked but the start date is from "1/1/2022" and i want it to start from "1/1/2016".
Any ideas?
Thank you again!
tt_and
3 years agoAdvocate I
Yes, the answer is in this line which is dynamic for both start and end (one year back in time (-1), and end of this year:
Source = {Number.From(#date(Date.Year(DateTime.LocalNow()) - 1,01,01))..Number.From(#date(Date.Year(DateTime.LocalNow()),12,31))}
You can set it relative to both start or end (-1 is -1 year).
Or with fixed start and dynamic end:
Source = {Number.From(#date(2016,01,01))..Number.From(#date(Date.Year(DateTime.LocalNow()),12,31))}Or with fixed start and end:
Source = {Number.From(#date(2016,01,01))..Number.From(#date(2023,12,31))}