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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

measure to return a value from a column with date offset

I'm trying to create a measure that allows me to return a value from a column in my facts table but filter it by current day offset from my dates table. I want to display this in a card. 

So I want to show the daily total from the same day last week. then create another card that shows same day two weeks ago and so on up to the previous same day 4 weeks. 

 

my facts table also has a date column. 

 

These are the two tables and column names.

'facts table' [daily total]
'Date' [CurrDayOffset]


Please can someone help me. 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try measure as below to calculated the daily total in previous same day n weeks.

Previous 1 Week Same day =
CALCULATE (
    SUM ( 'facts table'[daily total] ),
    FILTER ( ALL ( 'Date' ), 'Date'[Date] = SELECTEDVALUE ( 'Date'[Date] ) - 7 )
)
Previous 2 Weeks Same day =
CALCULATE (
    SUM ( 'facts table'[daily total] ),
    FILTER ( ALL ( 'Date' ), 'Date'[Date] = SELECTEDVALUE ( 'Date'[Date] ) - 7 * 2 )
)

...

Previous N Weeks Same day =
CALCULATE (
    SUM ( 'facts table'[daily total] ),
    FILTER ( ALL ( 'Date' ), 'Date'[Date] = SELECTEDVALUE ( 'Date'[Date] ) - 7 * N )
)

My Sample:

RicoZhou_0-1667543671271.png

RicoZhou_1-1667543680712.png

Result is as below.

RicoZhou_2-1667543712815.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Anonymous Thank you. I frustrated at how easy that it! I spent hors messing with various functions. 

Thank you. 

Anonymous
Not applicable

Hi @Anonymous ,

 

Please try measure as below to calculated the daily total in previous same day n weeks.

Previous 1 Week Same day =
CALCULATE (
    SUM ( 'facts table'[daily total] ),
    FILTER ( ALL ( 'Date' ), 'Date'[Date] = SELECTEDVALUE ( 'Date'[Date] ) - 7 )
)
Previous 2 Weeks Same day =
CALCULATE (
    SUM ( 'facts table'[daily total] ),
    FILTER ( ALL ( 'Date' ), 'Date'[Date] = SELECTEDVALUE ( 'Date'[Date] ) - 7 * 2 )
)

...

Previous N Weeks Same day =
CALCULATE (
    SUM ( 'facts table'[daily total] ),
    FILTER ( ALL ( 'Date' ), 'Date'[Date] = SELECTEDVALUE ( 'Date'[Date] ) - 7 * N )
)

My Sample:

RicoZhou_0-1667543671271.png

RicoZhou_1-1667543680712.png

Result is as below.

RicoZhou_2-1667543712815.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors