The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
User | Count |
---|---|
26 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
28 | |
13 | |
12 | |
12 | |
6 |