Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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
Solved! Go to Solution.
@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
Proud to be a 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
Proud to be a Super User! |
|
Yeah that worked, thank you! 🙂