Forum Discussion
FilipeSantos_pt
Helper I
2 years agoCalculation 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
Super User
2 years agoif you write it like this what do you get ?
Net Value =
VAR previousYear = MAX(Dates[Year]) -1
RETURN
previousYear
FilipeSantos_pt
Helper I
2 years agoI get 2023, which is the expected value since in the example the max is 2024