Forum Discussion

GrantC101's avatar
GrantC101
New Member
5 years ago
Solved

previous month last month filter

Hello All

 

Looking at getting some help with hopefully a simple filter.

I have been using the basic filters for Data filtering and have been asked to provide seprate tables for last months and any information before last month. The "last month" is easy, i am struggling with everything before last month with out showing last month.

I am unfimilier with dax and can only use the built in functions.

hopefully this makes sense and hoping to get some help

 

  • I have managed to achieve this using the following;

    each [Date Reported]<=Date.AddMonths(Date.From(Date.EndOfMonth(DateTime.LocalNow())),-2))

     

    thank you for the help

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Calculate(Sum(SomeTable[ColumnName]), Filter(WhateverTable, WhateverTable[Date] <= EOMONTH(TODAY(), -1)))

     

    --Nate

    • GrantC101's avatar
      GrantC101
      New Member

      Thank you for the quick reply how would I put this into Power Query Editor?

      • GrantC101's avatar
        GrantC101
        New Member

        I have managed to achieve this using the following;

        each [Date Reported]<=Date.AddMonths(Date.From(Date.EndOfMonth(DateTime.LocalNow())),-2))

         

        thank you for the help

  • Anonymous's avatar
    Anonymous
    Not applicable

    Oh, your original post mentioned DAX. It's even easier in Power Query. In the formula bar:

    = Table.SelectRows(Name of PriorStep, each [DateColumnName] <= Date.EndOfMonth(Date.AddMonths(Date.From(DateTime.LocalNow()), -2)))

     

    --Nate