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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
PowerRobots99
Helper II
Helper II

Data manipulation Help - Date Range

Input Table :--

 

PowerRobots99_0-1713507420522.png

 

 

Transformed Output Table:-

 

PowerRobots99_1-1713507455884.png

 

Please let me know is there any way to achieve this..

3 ACCEPTED SOLUTIONS

Sure. I'm attaching the pbix file.





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

This M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start", type date}, {"End", type date}, {"Job", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each {Number.From([Start])..Number.From([End])}),
    #"Expanded Date" = Table.ExpandListColumn(#"Added Custom", "Date"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Date",{"Start", "End"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"Date", type date}})
in
    #"Changed Type1"

Hope this helps.

Ashish_Mathur_0-1713600627034.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Anonymous
Not applicable

Hi @PowerRobots99 ,

Your solution is great, @_AAndrade , @Ashish_Mathur . it works like a charm! Here, I have another idea and I would like to share it for reference.


You can create a calculated table that writes dax expressions:

New Table =
GENERATE(
'Table'.
VAR _start_date = 'Table'[start]
VAR _end_date = 'Table'[end]
RETURN
FILTER(
CALENDAR(_start_date,_end_date),
[Date] >= _start_date && [Date] <= _end_date))

vkaiyuemsft_0-1713755222299.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

5 REPLIES 5
Anonymous
Not applicable

Hi @PowerRobots99 ,

Your solution is great, @_AAndrade , @Ashish_Mathur . it works like a charm! Here, I have another idea and I would like to share it for reference.


You can create a calculated table that writes dax expressions:

New Table =
GENERATE(
'Table'.
VAR _start_date = 'Table'[start]
VAR _end_date = 'Table'[end]
RETURN
FILTER(
CALENDAR(_start_date,_end_date),
[Date] >= _start_date && [Date] <= _end_date))

vkaiyuemsft_0-1713755222299.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Ashish_Mathur
Super User
Super User

Hi,

This M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start", type date}, {"End", type date}, {"Job", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each {Number.From([Start])..Number.From([End])}),
    #"Expanded Date" = Table.ExpandListColumn(#"Added Custom", "Date"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Date",{"Start", "End"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"Date", type date}})
in
    #"Changed Type1"

Hope this helps.

Ashish_Mathur_0-1713600627034.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
_AAndrade
Super User
Super User

Hi @PowerRobots99,

Here is my solution:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUByIjAyMTJR0lAzMkjqNSrA5Q3hxJyNAIieMEljc0Rpa3QOI4Q+QtkYSMTJA4LkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Start = _t, End = _t, Unit = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"Start", type date}, {"End", type date}, {"Unit", type text}}),
    Expand = Table.ExpandListColumn(Table.AddColumn(ChangedType, "Date", each List.Dates([Start], Duration.Days([End] - [Start]) + 1, #duration(1, 0, 0, 0))), "Date"),
    Result = Table.RemoveColumns(Expand, {"Start", "End"})
in
    Result


I hope this can solve your problem.





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




Could you please attach .pbix file here, it will help in understanding..

Sure. I'm attaching the pbix file.





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.