Forum Discussion

lastnn30's avatar
lastnn30
Post Patron
4 years ago
Solved

Top N using Card visual

Hi I have 2 fields, Name and Total. I want to create 2 cards, one to show the name of the person who scored the highest and the second card to show the highest number. for the highest number, it wor...
  • edhans's avatar
    4 years ago

    Hi lastnn30 - you cannot filter cards the same way you can tables and other visuals since they only return one value.

    Try this measure:

    Top Name = 
    VAR varTopValue = MAX('Latest File'[Total])
    VAR Result =
        MAXX(
            FILTER(
                'Latest File',
                'Latest File'[Total] = varTopValue
            ),
            'Latest File'[Name]
        )
    RETURN
        Result

     

    It gets the top value in that table, then gets the name of that person. MAXX() here is just converting the name to a scalar value, not returning the hightest name. the FILTER() function is returning a single record with Mark's data.