Forum Discussion

asjones's avatar
asjones
Helper V
3 years ago

Measure vs Variable in Calculate / Filter

I have the follwing measure that works. However if I remove the variable __T and make that a standalone measure and put that mesure in its place the results are incorrect. Why? I wold rather use a stand alone mesure instead of a variable. Any thoughts?

DAX for correct vs incorrect results below

thanks

Alan


** CORRECT RESULT **

Actuals to period =
VAR __T =
    SELECTEDVALUE ( Period_GL[Period] )
RETURN
    CALCULATE (
        [Financial Actuals (USD)],
        FILTER (
            ALL ( Period_GL ),
            202300 <= Period_GL[Period]
                && __T >= Period_GL[Period]
        )
    )



** INCORRECT RESULT **

Actuals to period 2 =
    CALCULATE (
        [Financial Actuals (USD)],
        FILTER (
            ALL ( Period_GL ),
            202300 <= Period_GL[Period] &&
[Period selected] >= Period_GL[Period]
        )
    )

2 Replies