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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.