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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AllanBerces
Post Prodigy
Post Prodigy

PQ -Date Distribution

Hi good day, can anyone help me on my PQ. I have a table and the date column is showing only start and end of the week, how can i distribute it per day.

AllanBerces_0-1752743182629.png

DESIRED OUTPUT

AllanBerces_1-1752743228599.png

Thank you

1 ACCEPTED SOLUTION
danextian
Super User
Super User

hi @AllanBerces 

Try the following custom column

let
    // Split date range string into list, e.g. "13/12 - 05/01" -> {"13/12", "05/01}
    split = Text.Split([Date], " - "),

    // Append year to each date part
    addYear = List.Transform(split, each _ & "/2025"),

    // Convert each string to a date using "en-gb" format
    toDate = List.Transform(addYear, each Date.From(_, "en-gb")),

    // Ensure start date is not after end date (handle year rollover)
    startDate = Number.From(
        if toDate{0} > toDate{1}
        then Date.AddYears(toDate{0}, -1)
        else toDate{0}
    ),

    // Convert end date to number
    endDate = Number.From(toDate{1}),

    // Generate list of date numbers between start and end
    dateAsNumber = {startDate..endDate},

    // Convert number list back to dates
    dateAsNumberToDate = List.Transform(dateAsNumber, Date.From)
in
    dateAsNumberToDate

This  will create a column containt lists of dates which can be expanded into individual date rows

danextian_0-1752744622835.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTWNzRS0FUwMNU3MFSK1YlWMjADsoAihkZgkVgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Dates", each let
    // Split date range string into list, e.g. "13/12 - 05/01" -> {"13/12", "05/01}
    split = Text.Split([Date], " - "),

    // Append year to each date part
    addYear = List.Transform(split, each _ & "/2025"),

    // Convert each string to a date using "en-gb" format
    toDate = List.Transform(addYear, each Date.From(_, "en-gb")),

    // Ensure start date is not after end date (handle year rollover)
    startDate = Number.From(
        if toDate{0} > toDate{1}
        then Date.AddYears(toDate{0}, -1)
        else toDate{0}
    ),

    // Convert end date to number
    endDate = Number.From(toDate{1}),

    // Generate list of date numbers between start and end
    dateAsNumber = {startDate..endDate},

    // Convert number list back to dates
    dateAsNumberToDate = List.Transform(dateAsNumber, Date.From)
in
    dateAsNumberToDate),
    #"Expanded Dates" = Table.ExpandListColumn(#"Added Custom", "Dates")
in
    #"Expanded Dates"




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
v-tejrama
Community Support
Community Support

Hi @AllanBerces ,

 

Has your issue been resolved?If the response provided by @danextian addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.


Thank you for your understanding!

 

danextian
Super User
Super User

hi @AllanBerces 

Try the following custom column

let
    // Split date range string into list, e.g. "13/12 - 05/01" -> {"13/12", "05/01}
    split = Text.Split([Date], " - "),

    // Append year to each date part
    addYear = List.Transform(split, each _ & "/2025"),

    // Convert each string to a date using "en-gb" format
    toDate = List.Transform(addYear, each Date.From(_, "en-gb")),

    // Ensure start date is not after end date (handle year rollover)
    startDate = Number.From(
        if toDate{0} > toDate{1}
        then Date.AddYears(toDate{0}, -1)
        else toDate{0}
    ),

    // Convert end date to number
    endDate = Number.From(toDate{1}),

    // Generate list of date numbers between start and end
    dateAsNumber = {startDate..endDate},

    // Convert number list back to dates
    dateAsNumberToDate = List.Transform(dateAsNumber, Date.From)
in
    dateAsNumberToDate

This  will create a column containt lists of dates which can be expanded into individual date rows

danextian_0-1752744622835.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTWNzRS0FUwMNU3MFSK1YlWMjADsoAihkZgkVgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Dates", each let
    // Split date range string into list, e.g. "13/12 - 05/01" -> {"13/12", "05/01}
    split = Text.Split([Date], " - "),

    // Append year to each date part
    addYear = List.Transform(split, each _ & "/2025"),

    // Convert each string to a date using "en-gb" format
    toDate = List.Transform(addYear, each Date.From(_, "en-gb")),

    // Ensure start date is not after end date (handle year rollover)
    startDate = Number.From(
        if toDate{0} > toDate{1}
        then Date.AddYears(toDate{0}, -1)
        else toDate{0}
    ),

    // Convert end date to number
    endDate = Number.From(toDate{1}),

    // Generate list of date numbers between start and end
    dateAsNumber = {startDate..endDate},

    // Convert number list back to dates
    dateAsNumberToDate = List.Transform(dateAsNumber, Date.From)
in
    dateAsNumberToDate),
    #"Expanded Dates" = Table.ExpandListColumn(#"Added Custom", "Dates")
in
    #"Expanded Dates"




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian thank you very much, big help and save me a lot of time.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.