The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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! 🙂