Forum Discussion
PY Sales Actually Pull Exact Same Period Last Year
I'm sorry, no this did not work.
However, I attempted another measure like this but now I am experiencing missing data since there were no sales on certain dates this year in 2020. All I want is my data to stop on the current day (today) (max day). For example if today was March 25th 2020 then all I would want to pull is Prior Year Jan 1 2019 to March 25 2019. The exact same time period. I would not want to pull entire month or year. Just pull net sales up current date. Below is the formula I used and the missing data
Hi LyncoData1 ,
Please try this one.
SamePeriodLatYear =
VAR tod =
TODAY ()
VAR lastyear =
DATE ( YEAR ( tod ) - 1, MONTH ( tod ), DAY ( tod ) )
VAR firstday =
DATE ( YEAR ( tod ) - 1, 1, 1 )
RETURN
CALCULATE (
[Net Sales],
FILTER (
ALL ( 'DimCalendar' ),
'DimCalendar'[DateKey] <= lasytear
&& 'DimCalendar'[DateKey] >= firstday
)
)
If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive for Business and share the link here.
- LyncoData16 years ago
Helper I
This did not work. However, I did use the two measures below that gave me what I wanted for Net Sales. However, now I need help with finding YTD MTD Sales based on the measures listed below to ensure they fall into the current "TODAY" time frame. Would you have any insight ?
Actual SamePeriodLastYear =CALCULATE ([Net Sales],FILTER ( 'DimCalendar', 'DimCalendar'[Month] <= MONTH( ( TODAY () ) )))Actual SamePeriodLastYear1 =CALCULATE([Actual SamePeriodLastYear],(SAMEPERIODLASTYEAR('DimCalendar'[DateKey])) )