Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
Please can you help me to achieve the table below. I wanted to show the data for Current week and Previous week, such that when a date is selected from the date filter, the selected date will appear under current week and previous Friday date will appear under previous week. Please note that our week ends on Fridays.
So, with the table below, the selected date from the Date filter would be 17/11/23.
then, with the table below the selected date from the date filter would be 10/11/23.
Many thanks in advance
Solved! Go to Solution.
Hi @Uka ,
I think you can create a Date table to help calculation.
Date =
VAR _STEP1 =
ADDCOLUMNS (
CALENDARAUTO (),
"Year", YEAR ( [Date] ),
"Month", MONTH ( [Date] ),
"WeekDay",
VAR _WEEKDAY =
WEEKDAY ( [Date], 2 )
RETURN
IF ( _WEEKDAY >= 6, _WEEKDAY - 5, _WEEKDAY + 2 ),
"DayName", FORMAT ( [Date], "DDDD" )
)
VAR _STEP2 =
ADDCOLUMNS (
_STEP1,
"WeekStart",
[Date] - [WeekDay] + 1,
"WeekEnd",
[Date] - [WeekDay] + 7
)
RETURN
_STEP2
Relationship:
Measure:
Measure =
VAR _SELECTDATE =
SELECTEDVALUE ( 'DimWeekEnd'[WeekEnd] )
VAR _PREWEEKEND = _SELECTDATE - 7
RETURN
IF (
MAX ( 'Date'[WeekEnd] ) IN { _SELECTDATE, _PREWEEKEND },
CALCULATE ( SUM ( 'Table'[Value] ) )
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Uka there are tons of videos/blog posts on this, have you done a google search for the solution?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k ,
Thanks for your reply but I have spent the whole day searching for the solution but could not find any.
All the solutions I found uses no filter in the view as I explained above.
I can show the current week and last week without the Dynamic Date Filter requirement.
Please if you can look into it I would appreciate!
Thanks
Hi @Uka ,
I think you can create a Date table to help calculation.
Date =
VAR _STEP1 =
ADDCOLUMNS (
CALENDARAUTO (),
"Year", YEAR ( [Date] ),
"Month", MONTH ( [Date] ),
"WeekDay",
VAR _WEEKDAY =
WEEKDAY ( [Date], 2 )
RETURN
IF ( _WEEKDAY >= 6, _WEEKDAY - 5, _WEEKDAY + 2 ),
"DayName", FORMAT ( [Date], "DDDD" )
)
VAR _STEP2 =
ADDCOLUMNS (
_STEP1,
"WeekStart",
[Date] - [WeekDay] + 1,
"WeekEnd",
[Date] - [WeekDay] + 7
)
RETURN
_STEP2
Relationship:
Measure:
Measure =
VAR _SELECTDATE =
SELECTEDVALUE ( 'DimWeekEnd'[WeekEnd] )
VAR _PREWEEKEND = _SELECTDATE - 7
RETURN
IF (
MAX ( 'Date'[WeekEnd] ) IN { _SELECTDATE, _PREWEEKEND },
CALCULATE ( SUM ( 'Table'[Value] ) )
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Many thanks for this solution.
It was very close to what I wanted, so I have modified to suit my situation.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.