Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi guys,
I'm trying to use SAMEPERIODLASTYEAR to see selected week based on slicer for This Year (TY) and Last Year (LY), however, when I select the week, it seems to reflect in TY column only but not in LY column as screenshot below (example here is I selected week 4)
I am trying to ensure that LY Week Selected also shows the number that is filtered in "Week" Slicer (or Max number of week if multiple weeks are selected in Slicer)
TY Week Selected =
if(ISFILTERED('Calendar Table'[Week Number]),MAX('Calendar Table'[Week Number]),MAX('Sales Table'[Latest Week Number]))
LY Week Selected = CALCULATE([Dummy Value],SAMEPERIODLASTYEAR('Calendar Table'[Date]))
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but when searching for last year's same week number value, please try something like below.
LY selected week sales: =
VAR _currentyear =
MAX ( 'calendar'[Year] )
VAR _lastyear = _currentyear - 1
VAR _selectedweeknumber =
MAX ( 'calendar'[Week number] )
VAR _lastyearperiod =
FILTER (
ALL ( 'calendar' ),
'calendar'[Year] = _lastyear
&& 'calendar'[Week number] = _selectedweeknumber
)
RETURN
IF (
HASONEVALUE ( 'calendar'[Year] ),
CALCULATE ( [This year selected week sales:], _lastyearperiod )
)
Hi,
I am not sure if I understood your question correctly, but when searching for last year's same week number value, please try something like below.
LY selected week sales: =
VAR _currentyear =
MAX ( 'calendar'[Year] )
VAR _lastyear = _currentyear - 1
VAR _selectedweeknumber =
MAX ( 'calendar'[Week number] )
VAR _lastyearperiod =
FILTER (
ALL ( 'calendar' ),
'calendar'[Year] = _lastyear
&& 'calendar'[Week number] = _selectedweeknumber
)
RETURN
IF (
HASONEVALUE ( 'calendar'[Year] ),
CALCULATE ( [This year selected week sales:], _lastyearperiod )
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
70 | |
55 | |
37 | |
31 |
User | Count |
---|---|
83 | |
64 | |
63 | |
49 | |
45 |