I was wondering if there is a way that I can have my measure detect today’s date and automatically add the appropriate context to YTD and LY measures. Currently, I always have to insert dates slicers to select the appropriate time context.
Yes, you can use the TODAY() function in DAX to return today’s date, and then build time intelligence off of that. For example, YEAR( TODAY() ) will return 2020. You can build it into almost any DAX time intelligence function, e.g., DATESBETWEEN, DATEDIFF, DATEADD, etc.
Here’s the entry for that function in the Enterprise DNA Knowledge Base:
And an example calculating sales from today through end of month:
Hope this is helpful. If you want to post a PBIX, we can work through a more specific solution.
Thanks for posting your question @jmolina. To receive a resolution in a timely manner please make sure that you provide all the necessary details on this thread.
Here is a potential list of additional information to include in this thread; demo pbix file, images of the entire scenario you are dealing with, screenshot of the data model, details of how you want to visualize a result, and any other supporting links and details.
Including all of the above will likely enable a quick solution to your question.
Hi @jmolina, we’ve noticed that no response has been received from you since the 2nd of April. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the checkbox. Thanks!