Apologies as I know this has been asked and answered numerous times before.
I'm trying to get the sales for LY 01/01/2022 to todays date but unsure on how to go about it.
I tried to use CALCULATE(SUM(Transactions[Sales]),SAMEPERIODLASTYEAR(Calendar[Date])) but this just pulls up the full year sales of previous years.
Any help would be greatly appreciated.
Solved! Go to Solution.
All of the replies were giving me full years value rather than same period for some reason.
I updated my calendar table which was 2020 - 2029 to 2020 - todays date and this one appeared to be better suited for my needs but still with a slight issue, it rolls up january and full month of february for the previous year rather than 01/01 - 20/02
Solved it by marking as date table! Thanks 🙂
Did you test my formula, I specifically made it same period?
FILTER(ALL(Calendar),YEAR(Calendar[Date]) = todayYear -1 && Month(Calendar[Date]) <= todayMonth && Day(Calendar[Date]) <= todayDay
I am oversimplify so you can follow the DAX and test, but you need to start with wrting some variables.
VAR todayYear = Year(Today())
VAR todayMonth= Month(Today())
VAR todayDay = Day(Today())
FILTER(ALL(Calendar),YEAR(Calendar[Date]) = todayYear -1
&& Month(Calendar[Date]) <= todayMonth
&& Day(Calendar[Date]) <= todayDay )
Here is one way to do this:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.