Forum Discussion
FilipeSantos_pt
2 years agoHelper I
Calculation with date table with previous date not working
I have a Date Table dimension (created in DAX) and a fact Sales table where there is a connection with Dates[Date] and Sales[Date]. I need to get the max Year on the date filter and show the previou...
- 2 years ago
pls try this
Net Value =
VAR previousYear = MAX(Dates[Year]) -1
RETURNCalculate(
SUM(Sales[NetValue]),FILTER(All(Dates),
Dates[Year] = previousYear)
)
or ------Net Value =
VAR previousYear = MAX(Dates[Year]) -1
RETURNCalculate(
SUM(Sales[NetValue]),FILTER(ALLSELECTED(Dates),
Dates[Year] = previousYear)
)
Ahmedx
2 years agoSuper User
if you write it like this what do you get ?
Net Value =
VAR previousYear = MAX(Dates[Year]) -1
RETURN
previousYear
FilipeSantos_pt
2 years agoHelper I
I get 2023, which is the expected value since in the example the max is 2024