Forum Discussion

mjanecek's avatar
mjanecek
Helper I
3 years ago
Solved

Need Help with Dax

I have a measure (Avg Premium) that is filtered by month for all of 2022.     Here is a visual of the months and that measure.         I am trying to write a measure that will allow me to pull...
  • ppm1's avatar
    3 years ago

    You can use a DAX pattern like this to return your max month in a card visual. Update it with your actual table, column, and measure names.

    MaxMonth =
    VAR vSummary =
        ADDCOLUMNS ( ALLSELECTED ( 'Date'[YearMonthShort] ), "cQty", [Total Qty] )
    VAR vTop1 =
        TOPN ( 1, vSummary, [cQty], DESC )
    RETURN
        MAXX ( vTop1, 'Date'[YearMonthShort] )

    Pat