Forum Discussion
SAMEPERIODLASTYEAR is blank
- 4 years ago
Hi nhaghani ,
According to your description, I create a sample.
I think you should put a date column in the visual, the SAMEPERIODLASTYEAR function should be based on an exact date.
LY-YTD Dotcom = CALCULATE(SUM('Ulta Dotcom'[Sales]),SAMEPERIODLASTYEAR('Ulta Dotcom'[Ending-Date]))I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 4 years ago
Hi nhaghani ,
I'm clear, you can modify the formula like this:
LY-YTD Dotcom = IF ( MAX ( 'Ulta Dotcom'[Ending-Date] ) > DATE ( YEAR ( TODAY () ) - 1, MONTH ( TODAY () ), DAY ( TODAY () ) ), BLANK (), CALCULATE ( SUM ( 'Ulta Dotcom'[Sales] ), SAMEPERIODLASTYEAR ( 'Ulta Dotcom'[Ending-Date] ) ) )Best Regards,
Community Support Team _ kalyj
Hi,
Create a Calendar Table with a relationship from the Accounting Date column of your Table to the Date column of the Calendar Table. In the Calendar Table, write calculated column formulas to extract Year, Month Name and Month number. Sort the Month name column by the Month number. To your visual, drag Year and Month name from the Calendar Table. Write these measures
Total = SUM('AP Ops Header Level Report- PS'[sum(Amount Invoiced)])
Total in same period last year = calculate([Total],sameperiodlastyear(calendar[date]))
Hope this helps.