Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Summarize, SummarizeColumns or a 3rd option

Hi, I am currently trying to solve a table manipulation issue i DAX. The problem is; I would like to take the last value in the period (Dec = 35) and use this as constant in a calculation where I co...
  • sturlaws's avatar
    sturlaws
    6 years ago

    Since you have a tabular model, I assume that you don't have to use month names for determening the last month, but can use something like month number or date:

    ComparisonMeasure =
    VAR mxMon =
        CALCULATE ( MAX ( 'Table'[Month] ); ALL ( 'Table' ) )
    VAR mxVal =
        CALCULATE (
            VALUES ( 'Table'[Values] );
            FILTER ( ALL ( 'Table' ); 'Table'[Month] = mxMon )
        )
    RETURN
        COUNTROWS ( FILTER ( 'Table'; 'Table'[Values] > mxVal ) )