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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ashmitp869
Post Partisan
Post Partisan

Create date fields provide in the file - Date From to Date to .?

Hi,

Can I generate a date column from [Date From] until [Date To] in Power BI.

Similar like below image

ashmitp869_0-1715244528608.png

I have create for 2024 04

ashmitp869_1-1715244730306.png

I am getting the date range from [Date From] to [Date To]

ashmitp869_2-1715244772502.png

 

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi @ashmitp869, like this?

 

Before

dufoq3_0-1715283696625.png

 

After

dufoq3_0-1715283817218.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtE1MFTSUTLWNzDUB3GBbEMzOCdWB6bICCRhjqTK2ACLKnOghBFQlTFMlaW+gQlUUSwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Period = _t, #"Date From" = _t, #"Date To" = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"Date From", type date}, {"Date To", type date}}),
    Ad_Dates = Table.AddColumn(ChangedType, "Dates", each List.Dates([Date From], Duration.TotalDays([Date To] - [Date From]) +1, #duration(1,0,0,0)), type list),
    ExpandedDates = Table.ExpandListColumn(Ad_Dates, "Dates")
in
    ExpandedDates

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

2 REPLIES 2
dufoq3
Super User
Super User

Hi @ashmitp869, like this?

 

Before

dufoq3_0-1715283696625.png

 

After

dufoq3_0-1715283817218.png

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtE1MFTSUTLWNzDUB3GBbEMzOCdWB6bICCRhjqTK2ACLKnOghBFQlTFMlaW+gQlUUSwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Period = _t, #"Date From" = _t, #"Date To" = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"Date From", type date}, {"Date To", type date}}),
    Ad_Dates = Table.AddColumn(ChangedType, "Dates", each List.Dates([Date From], Duration.TotalDays([Date To] - [Date From]) +1, #duration(1,0,0,0)), type list),
    ExpandedDates = Table.ExpandListColumn(Ad_Dates, "Dates")
in
    ExpandedDates

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Elcin_7
Helper I
Helper I

Hi, 

Option 1 - Power Query- Add Column-Custom Column use the formula below

 

=Date.AddDays([Date], 13)

 

Option 2 - create a column in data panel and use the DAX formula below. If it necessary use the relevant table and column names from your data

 

Date to=
SWITCH(
    WEEKDAY('tablename'[Date from] + 1, 1),7, 'tablename'[Date from]  +13,  
        'tablename'[Date from]  +13
)
This option is conditional you can change the formula depending your weekday ect. In your example you need 13 days in any condition. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.