# Latest Enterprise DNA Initiatives # WTD Calculation

To do the WTD calculation, I understand the below formula can be used:

Week to Date Sales =
var CurrentDate=LASTDATE(DimDate[FullDateAlternateKey])
var DayNumberOfWeek=WEEKDAY(LASTDATE(DimDate[FullDateAlternateKey]),3)
return
CALCULATE(
SUM(FactInternetSales[SalesAmount]),
DATESBETWEEN(
DimDate[FullDateAlternateKey],
CurrentDate,
-1*DayNumberOfWeek,
DAY),
CurrentDate))

But , in my case

LASTDATE cannot be used because [FullDateAlternateKey] is having future dates also.
How to tweak this formula to handle it?
sample 1_1_21.pbix (169.2 KB)

@Anu Create a column in your date table that will contain True for past dates and False for future dates and then use that column to filter dates table. sample 1_1_21.pbix (167.3 KB)

I tried applying the filter, but the result is not expected.
Expected result is 129 , sum of these: Hi Anu,

I understand that you are looking for a solution to sum Collections week_to_date (WTD).
If the following result seems OK, you can try the attached file. Measures:

``````Collection =
SUM( 'To Collect'[Collections] )
``````
``````Collection WTD =
VAR CurrentDate = SELECTEDVALUE( 'Date'[Date] )
VAR Result = CALCULATE(
[Collection],
'Date'[Date] <= CurrentDate,
CALCULATETABLE(
VALUES( 'Date'[Week Number] ),
'Date'[DateWithData] = TRUE
)
)

RETURN
Result
``````