Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Hanee
New Member

Offset and variables

Hi everyone, I am new to PowerBI and am trying to get ideas for making my work routine easier.
I want to make a variable for last week with OFFSET and then, make week on week for comparison as below.
However, though the first one for making VAR lw session_dax_VALUE)  is working, the entire one is not working.
Could you please help me? Thanks in advnace!
 
measure =
VAR lw_session_dax_VALUE =
    CALCULATE(sum('PL_Channel'[session]), offset (-1, , ORDERBY('PL_Channel'[yyyyww], asc) , , partitionby ('PL_Channel'[channel])))

var result = [lw_session_dax_VALUE]
RETURN  
    result
 
1 REPLY 1
lbendlin
Super User
Super User

yyyyww will not work across year boundaries. Instead, use steps of 7 on your day column, and use WINDOW instead of OFFSET.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors