Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

select rows from same period previous month

 Hi All,   i want help in pulling rows from table which have date column, in the date column it has values from both 2016 and 2017. now i want to pull particular records which fall in YTD and same...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Anonymous,

    You can add the following code in the Advanced Editor of your query.

    #"Filtered Rows" = Table.SelectRows(#"Changed Type1", each Date.Year([DateColumn]) = Date.Year(DateTime.LocalNow())-1 and Date.Month([DateColumn]) <= Date.Month(DateTime.LocalNow()) or Date.Year([DateColumn]) = Date.Year(DateTime.LocalNow()) and Date.Month([DateColumn]) <= Date.Month(DateTime.LocalNow()))
    


    You can review the following sample  to get mode details.


    Regards,
    Lydia