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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
crobson29
Helper I
Helper I

Expand Date column from showing first of each month to every date in month

Hello,

I have a column that has a date column that contains the first date of each month.  I want to expand this column to show every date for every month, and duplicate all the rows for each day.  I have a Budget that is formated like this: "Month", "Budget per day" and I want to be able to create a chart showing the cumulative total budget for the month.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@crobson29 , Create Date Table in Power query using List.Dates and also add column using Date.StartOfMonth and then merge your table using StartofMonth and FirstDate in your table

 

Power BI - Get Dates between range using Power Query List.Dates- https://youtu.be/SFEPsKfqIks

https://medium.com/@amitchandak/cheat-sheet-power-query-financial-year-calendar-5ceaacb520f1

 

Merge Tables (Power Query) : https://youtu.be/zNrmbagO0Oo

 

 

Or do it using just date table and Time Intellignece

 

Power BI Distributing/Allocating the Monthly Target(Convert to Daily Target): Measure ( Daily/MTD): https://community.powerbi.com/t5/Community-Blog/Power-BI-Distributing-Allocating-the-Monthly-Target-...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

v-xinruzhu-msft
Community Support
Community Support

Hi @crobson29 

The solution @amitchandak  provided is right, and i want to offer some more information for you to refer to.

You can create a blank query in power query and input the following code to advanced editor.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtE31DdU0lEyNFCK1YGKGIFFjJBEjMEixkCRWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, #"Budget per day" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type date}, {"Budget per day", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Dates([Month],Date.DaysInMonth([Month]),#duration(1,0,0,0))),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom")
in
    #"Expanded Custom"

Output

vxinruzhumsft_0-1712540619687.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-xinruzhu-msft
Community Support
Community Support

Hi @crobson29 

The solution @amitchandak  provided is right, and i want to offer some more information for you to refer to.

You can create a blank query in power query and input the following code to advanced editor.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtE31DdU0lEyNFCK1YGKGIFFjJBEjMEixkCRWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, #"Budget per day" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type date}, {"Budget per day", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Dates([Month],Date.DaysInMonth([Month]),#duration(1,0,0,0))),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom")
in
    #"Expanded Custom"

Output

vxinruzhumsft_0-1712540619687.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

amitchandak
Super User
Super User

@crobson29 , Create Date Table in Power query using List.Dates and also add column using Date.StartOfMonth and then merge your table using StartofMonth and FirstDate in your table

 

Power BI - Get Dates between range using Power Query List.Dates- https://youtu.be/SFEPsKfqIks

https://medium.com/@amitchandak/cheat-sheet-power-query-financial-year-calendar-5ceaacb520f1

 

Merge Tables (Power Query) : https://youtu.be/zNrmbagO0Oo

 

 

Or do it using just date table and Time Intellignece

 

Power BI Distributing/Allocating the Monthly Target(Convert to Daily Target): Measure ( Daily/MTD): https://community.powerbi.com/t5/Community-Blog/Power-BI-Distributing-Allocating-the-Monthly-Target-...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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