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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.