In our Power BI datasets, the best way to deals with dates and DAX intelligence functions is to use a Calendar Table. This table should be link to your Fact table. Good news, this table can be created in 2 clicks with Power Query (Transform Data) in Power BI!
How to create the table
Go to transform data and right click on Queries to create a new Blank Query
Now Copy the following code and paste it to the blank query create.
Run the function
Choose a StartDate and an EndDate, click Invoke
That’s it! You have a beautiful calendar table.
Do not forget to mark this table as a data table
Credit: I found this code on internet many years ago and used it in the LazyDAX file. I changed it, but I can’t redirect and credit the one who created it. I think it can help you a lot, that’s why I’m sharing it with you :)