Forum Discussion
Custom Fiscal Year error
- 1 year ago
arp2 - this will work for last week:
VAR LastWeekStart = SELECTEDVALUE ( FYCalendar[WeekStart] ) - 7 VAR LastWeekEnd = SELECTEDVALUE ( FYCalendar[WeekEnding] ) - 7 RETURN CALCULATE ( DISTINCTCOUNT ( MasterProjListR02[Project Number] ), REMOVEFILTERS ( FYCalendar ), MasterProjListR02[Project Creation Date] >= LastWeekStart, MasterProjListR02[Project Creation Date] <= LastWeekEnd )and your measure for YTD will already work:
see attached file
If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
arp2 - Once you've fixed any date format issues present, this could work for your weekly calculation:
ProjectsLastWeek2506 =
VAR LastWeekStart =
CALCULATE(MAX( FYCalendar[WeekStart]) -7, REMOVEFILTERS( FYCalendar ))
VAR LastWeekEnd =
CALCULATE(MAX( FYCalendar[WeekEnding]) -7, REMOVEFILTERS( FYCalendar ))
RETURN
CALCULATE(
COUNTROWS(MasterProjListR02),
REMOVEFILTERS( FYCalendar ),
MasterProjListR02[Project Creation Date] >= LastWeekStart,
MasterProjListR02[Project Creation Date] <= LastWeekEnd
)
I say should, becuase I cant really test it, your project data is limited but goes back to 2016 and your date data only has very select dates for 2024 and 2025 - for example 27/07/2024 onwards are completely missing:
If this is the date data you are actually using, then it explains why your YTD calculation is not working as well - in order to use this function you need a table of continuous dates.
If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
arp2 - this will work for last week:
VAR LastWeekStart =
SELECTEDVALUE ( FYCalendar[WeekStart] ) - 7
VAR LastWeekEnd =
SELECTEDVALUE ( FYCalendar[WeekEnding] ) - 7
RETURN
CALCULATE (
DISTINCTCOUNT ( MasterProjListR02[Project Number] ),
REMOVEFILTERS ( FYCalendar ),
MasterProjListR02[Project Creation Date] >= LastWeekStart,
MasterProjListR02[Project Creation Date] <= LastWeekEnd
)
and your measure for YTD will already work:
see attached file
If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
- arp21 year agoHelper II
mark_endicott This is extremely helpful. Thank you for your support. Good Day!