Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a simple model in Power BI with two tables. I have a custom Fiscal Year Calendar Table which is Date Table. The FY starts in July and ends in June. The week starts on Saturday and ends on Friday. Last Friday of the month is monthly cutoff so month does not necessarily start on the 1st and does not necessarily ends on 30th / 31st. This Fiscal Year Table has several FYs (few years in the past & few years in the future). I have a Project Register which has Project Number, Project Creation Date and other fields. I want to create measures. I am trying to create a measures to calculate number of Projects created last week and number of Projects created Year to Date. It is not working as I get zero in both the measures. Please help me.
(Example last week started on 14th Jun and ended on 20th Jun. Current FY is FY25 and it started on 29th Jun 2024 and will end on 27th Jun 2025.)
Solved! Go to Solution.
@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!
Hi @arp2,
Thank you for reaching out to the Microsoft fabric community forum. Also thanks to @mark_endicott, for his insights on this thread. I reproduced the scenario, and it worked on my end. I used my sample data and successfully implemented it. Used line chart.
outcome:
I am also including .pbix file for your better understanding, please have a look into it:
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
@v-kpoloju-msft thanks for the reply. The Projects Created Last Week works perfectly, however, YTD is showing 6 whereas Projects YTD are 7. You may check and revert so that we can learn an alternative way otherwise Mark has already provided the solution.
| Date | WeekEnding | MonthCutoff | FiscalYear | WeekStart |
| 6/29/2024 | 7/5/2024 | 7/26/2024 | FY25 | 6/29/2024 |
| 6/30/2024 | 7/5/2024 | 7/26/2024 | FY25 | 6/29/2024 |
| 7/1/2024 | 7/5/2024 | 7/26/2024 | FY25 | 6/29/2024 |
| 7/2/2024 | 7/5/2024 | 7/26/2024 | FY25 | 6/29/2024 |
| 7/3/2024 | 7/5/2024 | 7/26/2024 | FY25 | 6/29/2024 |
| 7/4/2024 | 7/5/2024 | 7/26/2024 | FY25 | 6/29/2024 |
| 7/5/2024 | 7/5/2024 | 7/26/2024 | FY25 | 6/29/2024 |
| 7/6/2024 | 7/12/2024 | 7/26/2024 | FY25 | 7/6/2024 |
| 7/7/2024 | 7/12/2024 | 7/26/2024 | FY25 | 7/6/2024 |
| 7/8/2024 | 7/12/2024 | 7/26/2024 | FY25 | 7/6/2024 |
| 7/9/2024 | 7/12/2024 | 7/26/2024 | FY25 | 7/6/2024 |
| 7/10/2024 | 7/12/2024 | 7/26/2024 | FY25 | 7/6/2024 |
| 7/11/2024 | 7/12/2024 | 7/26/2024 | FY25 | 7/6/2024 |
| 7/12/2024 | 7/12/2024 | 7/26/2024 | FY25 | 7/6/2024 |
| 7/13/2024 | 7/19/2024 | 7/26/2024 | FY25 | 7/13/2024 |
| 7/14/2024 | 7/19/2024 | 7/26/2024 | FY25 | 7/13/2024 |
| 7/15/2024 | 7/19/2024 | 7/26/2024 | FY25 | 7/13/2024 |
| 7/16/2024 | 7/19/2024 | 7/26/2024 | FY25 | 7/13/2024 |
| 7/17/2024 | 7/19/2024 | 7/26/2024 | FY25 | 7/13/2024 |
| 7/18/2024 | 7/19/2024 | 7/26/2024 | FY25 | 7/13/2024 |
| 7/19/2024 | 7/19/2024 | 7/26/2024 | FY25 | 7/13/2024 |
| 7/20/2024 | 7/26/2024 | 7/26/2024 | FY25 | 7/20/2024 |
| 7/21/2024 | 7/26/2024 | 7/26/2024 | FY25 | 7/20/2024 |
| 7/22/2024 | 7/26/2024 | 7/26/2024 | FY25 | 7/20/2024 |
| 7/23/2024 | 7/26/2024 | 7/26/2024 | FY25 | 7/20/2024 |
| 7/24/2024 | 7/26/2024 | 7/26/2024 | FY25 | 7/20/2024 |
| 7/25/2024 | 7/26/2024 | 7/26/2024 | FY25 | 7/20/2024 |
| 7/26/2024 | 7/26/2024 | 7/26/2024 | FY25 | 7/20/2024 |
| 5/31/2025 | 6/6/2025 | 6/27/2025 | FY25 | 5/31/2025 |
| 6/1/2025 | 6/6/2025 | 6/27/2025 | FY25 | 5/31/2025 |
| 6/2/2025 | 6/6/2025 | 6/27/2025 | FY25 | 5/31/2025 |
| 6/3/2025 | 6/6/2025 | 6/27/2025 | FY25 | 5/31/2025 |
| 6/4/2025 | 6/6/2025 | 6/27/2025 | FY25 | 5/31/2025 |
| 6/5/2025 | 6/6/2025 | 6/27/2025 | FY25 | 5/31/2025 |
| 6/6/2025 | 6/6/2025 | 6/27/2025 | FY25 | 5/31/2025 |
| 6/7/2025 | 6/13/2025 | 6/27/2025 | FY25 | 6/7/2025 |
| 6/8/2025 | 6/13/2025 | 6/27/2025 | FY25 | 6/7/2025 |
| 6/9/2025 | 6/13/2025 | 6/27/2025 | FY25 | 6/7/2025 |
| 6/10/2025 | 6/13/2025 | 6/27/2025 | FY25 | 6/7/2025 |
| 6/11/2025 | 6/13/2025 | 6/27/2025 | FY25 | 6/7/2025 |
| 6/12/2025 | 6/13/2025 | 6/27/2025 | FY25 | 6/7/2025 |
| 6/13/2025 | 6/13/2025 | 6/27/2025 | FY25 | 6/7/2025 |
| 6/14/2025 | 6/20/2025 | 6/27/2025 | FY25 | 6/14/2025 |
| 6/15/2025 | 6/20/2025 | 6/27/2025 | FY25 | 6/14/2025 |
| 6/16/2025 | 6/20/2025 | 6/27/2025 | FY25 | 6/14/2025 |
| 6/17/2025 | 6/20/2025 | 6/27/2025 | FY25 | 6/14/2025 |
| 6/18/2025 | 6/20/2025 | 6/27/2025 | FY25 | 6/14/2025 |
| 6/19/2025 | 6/20/2025 | 6/27/2025 | FY25 | 6/14/2025 |
| 6/20/2025 | 6/20/2025 | 6/27/2025 | FY25 | 6/14/2025 |
| 6/21/2025 | 6/27/2025 | 6/27/2025 | FY25 | 6/21/2025 |
| 6/22/2025 | 6/27/2025 | 6/27/2025 | FY25 | 6/21/2025 |
| 6/23/2025 | 6/27/2025 | 6/27/2025 | FY25 | 6/21/2025 |
| 6/24/2025 | 6/27/2025 | 6/27/2025 | FY25 | 6/21/2025 |
| 6/25/2025 | 6/27/2025 | 6/27/2025 | FY25 | 6/21/2025 |
| 6/26/2025 | 6/27/2025 | 6/27/2025 | FY25 | 6/21/2025 |
| 6/27/2025 | 6/27/2025 | 6/27/2025 | FY25 | 6/21/2025 |
@arp2 - At a guess, I would say you're not removing the filter context from your Fiscal Year Calendar and then re-adding the new context you wish to calculate. In order to do this you can use REMOVEFILTERS( Fiscal Year Calendar )
Here's an example:
VAR prev_week_start = SELECTEDVALUE( DateTable[Previous Week Start] )
VAR prev_week_end = SELECTEDVALUE( DateTable[Previous Week End] )
RETURN
CALCULATE( [Measure], REMOVEFILTERS( DateTable ), Table[Date] >= prev_week_start && Table[Date] <= prev_week_end )
However this is just a guess, because you've not provided your DAX that's returning 0 so.......
If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
Thnx @mark_endicott I have pasted sample tables here above and the measures I have created (but not working).
@arp2 - is that exactly how your data is?
Because 11/7/2018 is not a valid date, but 11/07/2018 is.
Go to Power Query and check if the Project Creation Date column is formatted as a date, if it's not, do so and I suspect you'll either fix this column, or you'll see a column full of errors (I have fixed the first 4 rows below):
Your DAX for the week calculation is missing the REMOVEFILTERS I suggested and your date parameters wont work, but the YTD one should work if we were using a date column.
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!
@mark_endicott This is extremely helpful. Thank you for your support. Good Day!
| Project Number | Project Name | Project Creation Date |
| 123 | ProjName1 | 7/30/2018 |
| 124 | ProjName2 | 2/25/2016 |
| 125 | ProjName3 | 3/20/2018 |
| 126 | ProjName4 | 11/7/2018 |
| 127 | ProjName5 | 6/26/2019 |
| 128 | ProjName6 | 2/14/2016 |
| 129 | ProjName7 | 10/27/2020 |
| 130 | ProjName8 | 7/29/2024 |
| 131 | ProjName9 | 7/29/2024 |
| 132 | ProjName10 | 7/29/2024 |
| 133 | ProjName11 | 7/29/2024 |
| 134 | ProjName12 | 7/29/2024 |
| 135 | ProjName13 | 7/29/2024 |
| 136 | ProjName14 | 6/17/2025 |
| 137 | ProjName15 | 7/29/2024 |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 56 | |
| 45 | |
| 35 | |
| 34 | |
| 21 |
| User | Count |
|---|---|
| 143 | |
| 122 | |
| 100 | |
| 80 | |
| 57 |