Forum Discussion
Syndicate_Admin
Administrator
4 years agoDATEADD returns blank value
Estimated. I have the following problem with some DAX formulas, where I want to calculate last year's sales using DATEADD. The formulas would be as follows: 1) LYTD = CALCULATE([YTD],DATEAD...
Ashish_Mathur
Super User
4 years agoHi,
You must have a calendar Table with calculated column formulas for Year, Month name and Month number. Sort the Month name column by the Month number. Create a relationship from the Period column to the Date column of the Calendar Table. To your visual, filter and slicers, drag any date field from the Calendar Table. Write this measure
LYTD = CALCULATE([YTD],SAMEPERIODLASTYEAR(Calendar[Date]))
Hope this helps.
- Syndicate_Admin3 years ago
Administrator
Thank you dear!
I followed the advice to create a month column in the calendar table, and in the visual filter of the card, select the months that interested me to calculate growth (1, 2, 3,... 7).
And then, I used the following formulas.
Growth % = [YTD]/[LYTD]-1YTD = TOTALYTD('Measures'[Measures],Calendar[Date])LYTD = CALCULATE([Measures],DATEADD(Calendar[Date],-1,YEAR))Best regards