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.
Hi all!
I need help with a dax function for last year data. I am using this function to calculate, for example, the revenue.
Hello @Anonymous,
Have you tried using the DATESYTD function?
Instead of DATEADD('TableDates [Date]'[date]; -1; YEAR), you can use:
DATESYTD ( 'TableDates [Date]'[Date] )
More info: https://docs.microsoft.com/en-us/dax/datesytd-function-dax
Also, your table naming ('TableDates [Date]') is quite confusing as it has square brackets which are normally used for column notation.
Hope this helps!
Alex
Thanks for your answer Alex,
In this case we have several dates table so we have this names in brackes to know which one we have to use, just a name.
I have seen that DATESYTD https://dax.guide/datesytd/ function will sum all the values in the year, but I need to compare year and year-1 in two lines., gettin the same value in 201829 tan 201929 - Previous year. I have uploaded the question with an example.
@Anonymous wrote:Hello @Anonymous,
Have you tried using the DATESYTD function?
Instead of DATEADD('TableDates [Date]'[date]; -1; YEAR), you can use:
DATESYTD ( 'TableDates [Date]'[Date] )More info: https://docs.microsoft.com/en-us/dax/datesytd-function-dax
Also, your table naming ('TableDates [Date]') is quite confusing as it has square brackets which are normally used for column notation.
Hope this helps!
Alex
Hey,
this article
https://www.daxpatterns.com/time-patterns/
will provide additional hints how to find the "exact" same timeframe in the past, of course one has to decide how leap years have to be handles.
Regards,
Tom
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.
User | Count |
---|---|
11 | |
11 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
11 |