The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.
Solved! Go to Solution.
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:
Result is as below.
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.
@Anonymous Thank you. I frustrated at how easy that it! I spent hors messing with various functions.
Thank you.
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:
Result is as below.
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.