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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
aatish178
Helper IV
Helper IV

How to use existing date column to create a calendar in power query editor

Hi All,

I already have a table loaded in power query. That table is having salesdate column.

I want to use this salesdate column to create a calendar table in power query itself.

 

Can someone plz help me know how can I use existing column to create a date range in power query as a seperate calendar table

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @aatish178 

You can refer to the following solution.

Sample data

vxinruzhumsft_0-1724379152072.png

Based on the table, you can create a blank query and put the following code to advanced editor in power query.

let
    Query1 = let
   min_date=List.Min(Table[Salesdate]),
   max_date=List.Max(Table[Salesdate])
in
    List.Dates(min_date,Duration.Days(max_date-min_date)+1,#duration(1,0,0,0)),
    #"Converted to Table" = Table.FromList(Query1, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    #"Converted to Table"

vxinruzhumsft_1-1724379387195.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

2 REPLIES 2
aatish178
Helper IV
Helper IV

Till now I had just seen people are hardcoding start date and end date in parameter and then generating list of dates between 2 parameters using power query M language, but here I want to refer a existing salesdate column to find out min and Max in power query and then generating list of dates using that

 

Anonymous
Not applicable

Hi @aatish178 

You can refer to the following solution.

Sample data

vxinruzhumsft_0-1724379152072.png

Based on the table, you can create a blank query and put the following code to advanced editor in power query.

let
    Query1 = let
   min_date=List.Min(Table[Salesdate]),
   max_date=List.Max(Table[Salesdate])
in
    List.Dates(min_date,Duration.Days(max_date-min_date)+1,#duration(1,0,0,0)),
    #"Converted to Table" = Table.FromList(Query1, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    #"Converted to Table"

vxinruzhumsft_1-1724379387195.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.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors