Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

UNIQUE MAX VALUE

Hello 

I am trying to use the dax code below to find a max value. I was able to show the max value but im my chart there are 2 months with the same max value. Is it possible to show only one?

 

UNique_Max =
VAR MaxCount =
MAXX ( VALUES ( Table[month] ), CALCULATE ( COUNT ( [id] ) ) )
RETURN
CALCULATE (
CONCATENATEX (
FILTER (
VALUES (  Table[month] ),
CALCULATE ( COUNT ( [id] ) = MaxCount )
),
COUNT ( [id]
)
))
  • Hi Anonymous

    Use this formula in a measure

    MaxCount = 
    MAXX ( VALUES ( 'Table'[month] ), CALCULATE ( COUNT ( [id] ) ) )

     

    Best Regards

    Maggie

7 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous

     

    Where exactly within your code do you get the two values??

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello

      In my chart, i m displaying data from Jan to Nov and i have 2 months with the same amount.

  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi Anonymous

    Based on my understanding from your information,

    The “amount” refers to the number of count of “id”,

    the “Unique_Max” returns the count of “id’ for each month,

     

    For example, in the above example, month1 and month2 has the same amount of 5, so what result do you want?

    All rows show 5 for column “Unique_Max”, or only one row (month1 or month2?) returns 5?

     

    Please help me clear about your requirement.

     

    Best Regards

    Maggie

    • Anonymous's avatar
      Anonymous
      Not applicable

      I am trying to display the result of the formula in a "card visual" in powerBI, but once i have to " 2" Unique_Max such as 5 and 5, the card itself is showing "55" instead of "5". I m tryng to get only one "5". 

      please let me know if i was able to explain properly

      • AlB's avatar
        AlB
        Community Champion

        Hi Anonymous

        would it be possible for you to share the pbix? With dummy data if necessary