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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.