Forum Discussion
Syndicate_Admin
3 years agoAdministrator
DATEADD 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...
Anonymous
3 years agoNot applicable
Dont Use YTD in Lytd
LYTD= CALCULATE([sum of sale],DATEADD('PM CHILE Premium'[Period],-1,YEAR))
- Syndicate_Admin3 years agoAdministrator
Thank you dear, unfortunately it did not work for me, but by following your advice, I was inspired to make the following modifications:
I created a Calendar Table and related my Base to it.
1) LYTD = CALCULATE([Medidas],DATEADD(Calendario[Date],-1,YEAR))
2)
Measures = SWITCH(TRUE(),VALUES(Measurement[Measure]) = "Counting Units", INT(SUM('PM CHILE Premium'[Counting Units]))/1,VALUES(Measurement[Measure]) = "Standard Units", INT(SUM('PM CHILE Premium'[Standard Units]))/1,VALUES(Measurement[Measure]) = "Units", INT(SUM('PM CHILE Premium'[Units])/1),VALUES(Measurement[Measure]) = "Value (List LC)", INT(SUM('PM CHILE Premium'[Value (List LC)])/1),VALUES(Measurement[Measure]) = "Value (List USD)", INT(SUM('PM CHILE Premium'[Value (List USD)])/1))However, this happens:The YTD gives me correct, because it is the sum of January to July 2022, but the LYTD now gives me the total of the year 2021, when it should be January to July 2021 (which should be 878.8 and not 1560 as it appears in the image).Best regards!