Forum Discussion
Hekp with M Query
- 2 years ago
Below query worked for me as per my requirement,to retrieve data for last 18 months,
As I also need a number format not a date format.
Hi smeg - if you enter the following function the result is 20211231:
= (((Date.Year(Date.AddDays(DateTime.LocalNow(), -1 )) - 2) * 10000) + 1231)
// 20221231This result is number, not a date.
Could you use the following function instead.
= Date.AddMonths( Date.StartOfMonth( DateTime.LocalNow() ) , -18)
// 01/06/2022 00:00:00Another thing to consider is the Data Type of the [PE_Date_Int] column. Is it Date? The example "06012022" suggest that it might be Text.
Hi
Data Type of the [PE_Date_Int] column is integer(number) not a date,How can i cast/convert below function accordingly because when i use below one the data refresh is taking forever,because of comparison between number and date.
= Date.AddMonths( Date.StartOfMonth( DateTime.LocalNow() ) , -18)
Thanks..
- wdx223_Daniel2 years agoCommunity Champion
= Number.From(Date.ToText(Date.AddMonths( Date.StartOfMonth( DateTime.LocalNow() ) , -18),"yyyyMMdd"))
- smeg2 years agoHelper I
Below query worked for me as per my requirement,to retrieve data for last 18 months,
As I also need a number format not a date format.