Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gabreila
Frequent Visitor

Filter in column date

Hello
I don't know English, sorry for the mistakes.
But I need help in power query. I only want the data in the date column without the current month of the previous year - that is, without data from 1.6.-30.6.2019 - so that it is automatic.
Thank you.
Gabriela

1 ACCEPTED SOLUTION

@gabreila 

Place this M code in a blank query to see the steps. The important one is the last one, #"Filtered Rows"

 

let
    Source = List.Dates(#date(2019,1,1),365,#duration(1,0,0,0)),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),

    #"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each [Date] < Date.AddYears(Date.From(Date.StartOfMonth(DateTime.LocalNow())),-1) or [Date] > Date.AddYears(Date.From(Date.EndOfMonth(DateTime.LocalNow())),-1))
in
    #"Filtered Rows"

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

4 REPLIES 4
AlB
Super User
Super User

Hi @gabreila 

Tha should be easy. You can use the filter in Power query. Make sure your column is of type date. Then go to date filters and choose

is before ---> June 1st, 2019

OR

is after --> June 30th, 2019

 

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

gabreila
Frequent Visitor

Thank you, but I don't want to enter the dates manually, but to enter the current month automatically.

@gabreila 

Place this M code in a blank query to see the steps. The important one is the last one, #"Filtered Rows"

 

let
    Source = List.Dates(#date(2019,1,1),365,#duration(1,0,0,0)),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),

    #"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each [Date] < Date.AddYears(Date.From(Date.StartOfMonth(DateTime.LocalNow())),-1) or [Date] > Date.AddYears(Date.From(Date.EndOfMonth(DateTime.LocalNow())),-1))
in
    #"Filtered Rows"

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

gabreila
Frequent Visitor

Thank you very much for your help.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors