Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Max amount

Hey guys I am trying to create a Dax measure that will give me the MAX amount by the Max month, I want that measure to dynamic. For example if there is a new month, i need that measure to dynamically...
  • daxer-almighty's avatar
    5 years ago
    // First of all, you have to
    // be able to determine which
    // month is the last one. To do
    // that you need to number your
    // months. Say you've created
    // a column called MonthConsecutiveNumber.
    // Then, to always get the amount for the
    // very last month, you write:
    
    [Last Month Amount] =
        SUMX(
            TOPN(1,
                ALL( T ),
                T[MonthConsecutiveNumber],
                DESC
            ),
            T[Amt]
        )