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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
AlB
Community Champion
Community Champion

@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
Community Champion
Community Champion

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.

AlB
Community Champion
Community Champion

@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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.