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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
hi_world
Helper III
Helper III

Quickly generate year, quarter, month, and day columns

Hello, 

 

firste question : quickly generate year, quarter, month, and day columns for each date in a power query table.
I have several dates in different tables (one hundred).

Second question: Is it possible for each table to create the 4 columns in a single step?

 

here there is no question of creating a date table. I just need to split each date into four columns.

Best regards

4 REPLIES 4
AlienSx
Super User
Super User

Hello, @hi_world 

let
    tbl = #table({"date_column"}, {{#date(2023, 03, 11)}, {#date(2023, 03, 23)}}),
    new_columns = 
        Table.ExpandRecordColumn(
            Table.TransformColumns(
                tbl,
                {"date_column",
                each Record.AddField(Date.ToRecord(_), "Quarter", Date.QuarterOfYear(_))}
            ),
            "date_column",
            {"Year", "Quarter", "Month", "Day"}
        )
in
    new_columns

Hello @AlienSx , 

 

Thank you ! it works fine in import mode but it does not work in my use case because i'm using direct query mode. 

Do you have any way to do that in DirectQuery ? 

 

Best regards

@hi_world , nope, sorry. This is what MS site says:

  • If the Power Query Editor query is overly complex, an error occurs. To fix the error, you must either delete the problematic step in Power Query Editor, or switch to import mode. Multidimensional sources like SAP BW can't use the Power Query Editor.


 

Thank you @AlienSx 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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