Forum Discussion
ganiu_s
2 years agoNew Member
Previous year calculation
I have this query that is meant to calculate the data from last year every time i select the current year it should get previous data without having to hard code the year into the dax /* VAR ...
rajendraongole1
2 years agoSuper User
Hi ganiu_s - Create a Date Table (if not already done) using new table Dax.
Mark DateTable as a Date table by going to Table tools >> Mark as Date Table, and select the Date column.
create a new measure
VolumePreviousYear =
VAR SelectedYear = SELECTEDVALUE('DateTable'[Year]) - 365
RETURN
CALCULATE(
COUNT('YourTableName'[ID]),
FILTER(
ALL('DateTable'),
'DateTable'[Year] = SelectedYear
)
)
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!