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
Rygar
Helper II
Helper II

Find start date of week and repeat the date

Dear Community,

 

i have a Column with ascending dates and need the starting date of each week in a second column:

Bild1.png

I need this in Power Query. Example File here.

Thanks and regards, Michael

1 ACCEPTED SOLUTION
m_alireza
Solution Specialist
Solution Specialist

Hi @Rygar ,

Create a Custom Column in Power Query and enter this: 

=Date.StartOfWeek([From this], Day.Monday)


where [From this] equals name of your date column

View solution in original post

4 REPLIES 4
AntrikshSharma
Community Champion
Community Champion

@Rygar Use this:

let
    Source = Table.FromRows (
        Json.Document (
            Binary.Decompress (
                Binary.FromText (
                    "Vc67DcAwDAPRXVwHkER/Ys1ieP81DBdByPJVd2uVaUiDA2U/V9VF8StNAEZlNEZnDMbLmIyUqIt0SCZCLuLb2Ac=",
                    BinaryEncoding.Base64
                ),
                Compression.Deflate
            )
        ),
        let
            _t = ( ( type nullable text ) meta [ Serialized.Text = true ] )
        in
            type table [ #"From this" = _t ]
    ),
    ChangedType = Table.TransformColumnTypes ( Source, { { "From this", type date } } ),
    WeekOfYear = 
        Table.AddColumn (
            ChangedType,
            "Week of Year",
            each Date.WeekOfYear ( [From this], Day.Monday ),
            Int64.Type
        ),
    GroupedRows = 
        Table.Group (
            WeekOfYear,
            { "Week of Year" },
            {
                {
                    "Transformation",
                    ( Dates ) =>
                        Table.AddColumn (
                            Table.RemoveColumns ( Dates, "Week of Year" ),
                            "To this",
                            each List.Min ( Dates[From this] ),
                            type date
                        )
                }
            }
        ),
    RemovedOtherColumns = Table.Combine ( GroupedRows[Transformation] )
in
    RemovedOtherColumns

 

Thanks a lot 4 your support!

 

m_alireza
Solution Specialist
Solution Specialist

Hi @Rygar ,

Create a Custom Column in Power Query and enter this: 

=Date.StartOfWeek([From this], Day.Monday)


where [From this] equals name of your date column

Great! Thanks a lot.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors