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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Display Highest Value of Count in a Card

I'm trying to display the highest 'id' value in a table with the most appearances (highest number of Count). The attached screenshot shows what I mean. Since the 'customer_id' value of 3220 appears 90 times, I want the card to display 3220 as the value. How do I do this?

 

 Screenshot 2020-07-09 at 09.29.15.png

1 ACCEPTED SOLUTION

hi  @Anonymous 

Ok, for your case, there are some blank [customer_id] in the table, so adjust the formula as below:

Highest Value of Count = 
var _countid=MAXX(FILTER(ALLSELECTED('Sheet1'[customer_id]),[customer_id]<>BLANK()),CALCULATE(COUNTA('Sheet1'[customer_id]))) return
CALCULATE(MAX('Sheet1'[customer_id]),FILTER(VALUES('Sheet1'[customer_id]),CALCULATE(COUNTA('Sheet1'[id]))=_countid))

Result:

12.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

14 REPLIES 14
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

For your case, just create a measure as below:

Highest Value of Count = 
var _countid=MAXX(ALLSELECTED('Table'[customer_id]),CALCULATE(COUNTA('Table'[customer_id]))) return
CALCULATE(MAX('Table'[customer_id]),FILTER('Table',CALCULATE(COUNTA('Table'[customer_id]))=_countid))

 

then drag it into a card visual.

7.JPG

here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Screenshot 2020-07-10 at 11.13.00.png

hi  @Anonymous 

You could copy the formula of measure and just change the table name for yours

Highest Value of Count =
VAR _countid =
    MAXX (
        ALLSELECTED ( 'Table'[customer_id] ),
        CALCULATE ( COUNTA ( 'Table'[customer_id] ) )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[customer_id] ),
        FILTER ( 'Table', CALCULATE ( COUNTA ( 'Table'[customer_id] ) ) = _countid )
    )

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I did as you instructed but ended up with a (Blank) as a result...

 

Screenshot 2020-07-10 at 12.18.39.png

hi  @Anonymous 

Could you please share your sample pbix file for us have a test, that will be a great help.

You can upload it to OneDrive for business and post the link here. Do mask sensitive data before uploading.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

https://techship1-my.sharepoint.com/:u:/g/personal/eric_shao_techship_com/EX3OubkDqtpNrJXzlelYWP4BU1... 

Here is the link. I only kept the table with the two columns needed.

hi  @Anonymous 

Ok, for your case, there are some blank [customer_id] in the table, so adjust the formula as below:

Highest Value of Count = 
var _countid=MAXX(FILTER(ALLSELECTED('Sheet1'[customer_id]),[customer_id]<>BLANK()),CALCULATE(COUNTA('Sheet1'[customer_id]))) return
CALCULATE(MAX('Sheet1'[customer_id]),FILTER(VALUES('Sheet1'[customer_id]),CALCULATE(COUNTA('Sheet1'[id]))=_countid))

Result:

12.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous,

you didn't tell us that your column customer_id contains blank ids. That's messy.

But here is my solution:

 

13-07-_2020_23-46-50.png

 

 

Regards FrankAT

Hi @Anonymous,

take a look at the following measure:

 

10-07-_2020_12-46-40.png

 

Anonymous
Not applicable

The column [Count of id] does not exist in my data. That column is calculated by doing a Count on the appearances of column [id].

Hi @Anonymous,

here is my revised solution:

[1] Only for overview

[2] Card visual with returned value of my sample data

 

10-07-_2020_14-17-55.png

 

Regards FrankAT

Anonymous
Not applicable

Screenshot 2020-07-13 at 14.18.43.png

Still getting (Blank) as a RETURN value. VAR _HighestCount comes out to be 90 as expected.

amitchandak
Super User
Super User

@Anonymous , Put customer Id on Card

Create a rank measure and put visual level filter Rank =1

 

Rank =rankx(all(table[customer]),[count of id],,desc,dense)

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I'm unable to use or interact with any visual level filters that are put on the Card?

https://community.powerbi.com/t5/Desktop/Problem-with-visual-level-filtering-on-card/td-p/31635/page...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.