Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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]
)
))
1 ACCEPTED SOLUTION

Hi @Anonymous

Use this formula in a measure

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

11.png

 

Best Regards

Maggie

View solution in original post

7 REPLIES 7
v-juanli-msft
Community Support
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,

 1.png

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
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

Hi @Anonymous

Use this formula in a measure

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

11.png

 

Best Regards

Maggie

Anonymous
Not applicable

@v-juanli-msft Thanks a lot 

Hi @Anonymous

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

AlB
Super User
Super User

Hi @Anonymous

 

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

Anonymous
Not applicable

Hello

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.