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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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