Forum Discussion

glynwilks's avatar
glynwilks
Helper I
3 years ago
Solved

Count Top N

Hello, I  am using dyamic text to display the following.   The below also shows that <Top Agent> has received the most positive responses from end users with a total of <Total Positive Responses> p...
  • Ritaf1983's avatar
    Ritaf1983
    3 years ago

    Hi glynwilks 
    To achieve a goal I created 3 measures:

    1. Counter of positive responses :

    PositiveCount =
    CALCULATE(
        COUNTROWS('table'),
        'Table'[Rating Name] = "Positive"
    )
    2. Top 1 for aggent :
    Top agent =
    TOPN(1,
        ALL('table'[Agent]),
        [PositiveCount],
        DESC)
    3. "Filtered" counter that you can put on your text:
    Top1PositiveCount =
    CALCULATE(
        [PositiveCount],  -- Your previously created PositiveCount measure
        TOPN(1, ALL('table'[Agent]), [PositiveCount], DESC)
    )
    + Text measure :
    Top agent text = "Top agent is " & [Top agent] & "He has " & [Top1PositiveCount] & " positive responses"
    Result :