Here is what I use for something similar using M Code. Here is link to my post with all the info.
If you open my PBIX that I shared on the 1st challenge post here in the forum, you can see how I set it up. I use this in most of my models. Many clients don’t want bothered with having to manually change the date range.