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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Fabi1208
Frequent Visitor

Change from a date interval to single dates

Hello everyone! 😊

 

I have a tricky problem with my data set. In the picture below you see the date "from" and "to". This means, that the employee was e.g. sick from a specific date to a specific date. So, only the timeframe and not the single days are given in the data set. But to analyse the data, I need every specific date of the illness of a single employee.

Fabi1208_3-1631556767771.png

 

E.g. "ID" number "10435189" , I need instead of 01.09.2021 to 03.09.2021 something like this:

 

Fabi1208_1-1631556572803.png

 

Do you have an idea or a suggestion for me how to solve my problem?

Thank you very much in advance.

 

Best regards,

Fabi

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Fabi1208 ,

 

Could you please provide some error messages to help us clarify your scenario?

 

I tried @Jakinta 's method and it worked fine on my side.

And I think the most effective way is to use {Number.From() ..Number.From()} to get all list of dates between two dates (From and To columns)

    #"Added Custom" = Table.AddColumn(#"Changed Type with Locale", "Custom", each {Number.From([From])..Number.From([To])}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", type date}})
in
    #"Changed Type1"

Output:

Eyelyn9_0-1631868275675.png

 

But anyway ,glad to see your issue has been resolved !

 

Refer to:

https://www.youtube.com/watch?v=u3HLseZxSj4

https://www.thepoweruser.com/2019/07/23/fill-dates-between-dates-with-power-bi-power-query/

 

Best Regards,
Eyelyn Qin
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 @Fabi1208 ,

 

Could you please provide some error messages to help us clarify your scenario?

 

I tried @Jakinta 's method and it worked fine on my side.

And I think the most effective way is to use {Number.From() ..Number.From()} to get all list of dates between two dates (From and To columns)

    #"Added Custom" = Table.AddColumn(#"Changed Type with Locale", "Custom", each {Number.From([From])..Number.From([To])}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", type date}})
in
    #"Changed Type1"

Output:

Eyelyn9_0-1631868275675.png

 

But anyway ,glad to see your issue has been resolved !

 

Refer to:

https://www.youtube.com/watch?v=u3HLseZxSj4

https://www.thepoweruser.com/2019/07/23/fill-dates-between-dates-with-power-bi-power-query/

 

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

Hi Eyelyn9,

 

thank you very much. This works perfectly. I am not sure why the other solution does not work for me, but this one was exaclty what I was looking for 🙂

 

Best regards and have a nice weekend,

Fabi

Jakinta
Solution Sage
Solution Sage

You can try with code below in blank query and adjust accordingly.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WsjQ1UtJRMtU30TcyRGaUFJWmKsXqRCsZGpgYmAEFLPSNDSFSCFZaYk4xXJWxKVDEUh8qZalvjKImFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, From = _t, To = _t, #"Half a day" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"From", type date}, {"To", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each List.Transform( {Number.From([From])..Number.From([To])}, Date.From)),
    #"Expanded Date" = Table.ExpandListColumn(#"Added Custom", "Date")
in
    #"Expanded Date"

Hi Jakinta,

thank you very much for your help and your quick response. I tried your solution out but in the end was not able to handle it. I called the creator of the source and in the end he was able to convert the date collumns into single dates instead of intervals. This solved the problem for me 🙂

Best regards,

Fabi

Hi Jakinta,

thank you very much for your help and your quick response. I tried your solution out but in the end was not able to handle it. I called the creator of the source and in the end he was able to convert the date collumns into single dates instead of intervals. This solved the problem for me 🙂

Best regards,

Fabi

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors