Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
I've generated a calendar table based on dates that exist in another table (so, "Give me all of the dates that appear in this other table").
Here's the m defining the start and end dates in my calendar table:
let StartDate = List.Min(Table[as_of_date]), EndDate = List.Max(Table[as_of_date]),
DayCount = Duration.Days(Duration.From(EndDate - StartDate)),
Source = List.Dates(StartDate,DayCount,#duration(1,0,0,0)),
TableFromList = Table.FromList(Source, Splitter.SplitByNothing()), ...
However, when I stack my source table and calendar table side-by-side, the latest date is always missing from my calendar table:
Please help! What am I doing wrong?
Solved! Go to Solution.
@Anonymous
Add + 1 to your duration,
= Duration.Days(Duration.From(EndDate - StartDate ))+ 1
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Anonymous
Add + 1 to your duration,
= Duration.Days(Duration.From(EndDate - StartDate ))+ 1
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
I just encountered the same problem again, and this solution worked again.
@Fowmy , what is it about the Duration.Days function that requires +1? Why won't this work without +1?
@Anonymous
By adding +1, you ensure that all days between the dates are included.
If StartDate = 1/1/2020 and EndDate = 1/5/2020 then you need the results inclusive of both dates which is 5.
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Fowmy Got it. So in M, the function Start Date - End Date is not inclusive, and +1 makes it so. Thanks!
Worked a treat! Thanks!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.