Forum Discussion
Neyney
1 year agoFrequent Visitor
Current Year versus Last Year Same time thi
I need to do a Current Year versus Last Year (based on the max date available this current year) ---- My LY YTD SALES formula seems off . My Current Year calculation (CY) based on the max date availa...
- 1 year ago
Hi, Neyney
Ty using Dates between,
refer, https://learn.microsoft.com/en-us/dax/datesbetween-function-daxuse this one below,
LY YTD Sales =CALCULATE([TotalSales],DATESBETWEEN('Sample_YTD_Sales_Data'[Paid Date],DATE(YEAR(MAX('Sample_YTD_Sales_Data'[Paid Date])) - 1, 1, 1),DATE(YEAR(MAX('Sample_YTD_Sales_Data'[Paid Date])) - 1, MONTH(MAX('Sample_YTD_Sales_Data'[Paid Date])), DAY(MAX('Sample_YTD_Sales_Data'[Paid Date])))),'Sample_YTD_Sales_Data'[IsPast] = TRUE())attached the pbix file for you.
rubayatyasmin
Community Champion
1 year agoHi, Neyney
Ty using Dates between,
refer, https://learn.microsoft.com/en-us/dax/datesbetween-function-dax
use this one below,
LY YTD Sales =
CALCULATE(
[TotalSales],
DATESBETWEEN(
'Sample_YTD_Sales_Data'[Paid Date],
DATE(YEAR(MAX('Sample_YTD_Sales_Data'[Paid Date])) - 1, 1, 1),
DATE(YEAR(MAX('Sample_YTD_Sales_Data'[Paid Date])) - 1, MONTH(MAX('Sample_YTD_Sales_Data'[Paid Date])), DAY(MAX('Sample_YTD_Sales_Data'[Paid Date])))
),
'Sample_YTD_Sales_Data'[IsPast] = TRUE()
)
attached the pbix file for you.
Neyney
1 year agoFrequent Visitor
Here is my updated formula based on your suggestion:
LY YTD Sales =
CALCULATE(
[All Sales Sum],
DATESBETWEEN(
'Paid Date Table'[Date],
DATE(YEAR(MAX('Paid Date Table'[Date])) - 1, 1, 1),
DATE(YEAR(MAX('Paid Date Table'[Date])) - 1, MONTH(MAX('Paid Date Table'[Date])), DAY(MAX('Paid Date Table'[Date])))
),
'Paid Date Table'[IsPast] = TRUE()
)
The field is now blank. What could be the problem? YOur help is much appreciated!