@fudzen88 When you use the measure branching technique you are calling a measure in the row context inside FILTER, a measure always has an invisible CALCULATE wrapped around it so the code that you think is same isn’t actually same, your first code looks something like this to the DAX Engine:
FILTER (
ALL ( Dates ),
Dates[Date] <= CALCULATE ( MAX ( Dates[Date] ) )
)
Calculate converts each row into Filter Context that defines what MAX would return. For each cell of the below visual, FILTER iterates ALL dates and then for each row iterated, CALCULATE performs context transition and shifts the currently iterated date in the row context to an equivalent filter context, once the calculation for one cell of the report is complete CALCULATE + MAX always return the last date, and then I get the COUNT which is the same as the number of rows in the Dates table.
But in the second code there is no CALCULATE around MAX, so MAX is getting filtered by the filter context that is created by the report so for each month I get Current Month + COUNT of all the previous months.
Moral of the short story, don’t create measures for code that you are going to use for evaluating or filtering tables. Always split the code into variables so that you won’t encounter hidden calculate. For example your First code will work if you store the [Max Date] in a variable and since variables are just constants it won’t invoke context transition.