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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Ben1981
Helper III
Helper III

Calculate value from a previous date

Hi,

I'm trying to write a measure to calculate the volume from a table but for the previous week selected in the filter. So the user can select the current week but the measure will show what is in the previous week. My data has a week column that is linked to the date table via week. 

My DAX measure is pretty much as shown below.

VAR = SelectedWeek = SELECTEDVALUE(Week)-7
RETURN
CALCULATE(COUNT(ID),'TABLE'WEEK = _SelectedWeek),ALLEXCEPT('DateTable'WEEK))

Any clue where I'm going wrong?
Thanks

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Ben1981 , Try using below mentioned method

 

VolumePreviousWeek =
VAR SelectedWeek = SELECTEDVALUE('DateTable'[Week]) - 7
RETURN
CALCULATE(
COUNT('YourTableName'[ID]),
FILTER(
ALL('DateTable'),
'DateTable'[Week] = SelectedWeek
)
)

 

Please accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
bhanu_gautam
Super User
Super User

@Ben1981 , Try using below mentioned method

 

VolumePreviousWeek =
VAR SelectedWeek = SELECTEDVALUE('DateTable'[Week]) - 7
RETURN
CALCULATE(
COUNT('YourTableName'[ID]),
FILTER(
ALL('DateTable'),
'DateTable'[Week] = SelectedWeek
)
)

 

Please accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Yeah that worked, thank you! 🙂

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors