Forum Discussion
Calculate an exact day between two given dates
- 4 years ago
Hi Anonymous
I recommend to use Power Query to get the exact dates between two given dates. You can open Power Query Editor from Home > Transform data in Power BI Desktop. Then follow below steps:
1. Add a custom column to calculate the length of each period.
Duration.Days( ([End Date] - [Start Date]) / [Period] )2. Add the second custom column. In every cell of the column, you will have a list that has all exact dates between the given dates.
List.Dates( Date.AddDays( [Start Date], [Period Days]), [Period] - 1, #duration([Period Days],0,0,0) )3. For the list column, you can choose to expand it to new rows or extract values per your need.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi Anonymous
I recommend to use Power Query to get the exact dates between two given dates. You can open Power Query Editor from Home > Transform data in Power BI Desktop. Then follow below steps:
1. Add a custom column to calculate the length of each period.
Duration.Days( ([End Date] - [Start Date]) / [Period] )
2. Add the second custom column. In every cell of the column, you will have a list that has all exact dates between the given dates.
List.Dates( Date.AddDays( [Start Date], [Period Days]), [Period] - 1, #duration([Period Days],0,0,0) )
3. For the list column, you can choose to expand it to new rows or extract values per your need.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
- Syndicate_Admin4 years ago
Administrator
Thank you very much, it had not occurred to me to create a list within another, cube type. I have to keep learning a lot.
Best regards.