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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to display just one top result in a PBI Card visualization

Hi, I need some help in coding the DAX. I came across this website https://blog.enterprisedna.co/showcase-the-top-result-name-within-a-card-visualization-using-power-b...and I tried to follow the coding for my case. But it does not work in my case. 

 

I am sharing the sample data and coding here. 

 

zxavierdeloitte_0-1606717019175.png

Program Table

zxavierdeloitte_1-1606717125193.png

If I click on FY 20, it should reflect the top program attended by participants. In my case, it shows blank value.

Not sure whether I have coded in a wrong way.

zxavierdeloitte_0-1606717438749.png

 

2 ACCEPTED SOLUTIONS
AlB
Community Champion
Community Champion

@Anonymous 

Ok, then you just need  TOPN(1,...   instead of TOPN( 2,...

 

 

Top Prog =
CONCATENATEX (
    TOPN (
        1,
        DISTINCT ( Program[Programme Name] ),
        [Total no of program attendees], DESC
    ),
    Program[Programme Name],
    ", "
)

 

 

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

View solution in original post

Anonymous
Not applicable

8 REPLIES 8
Anonymous
Not applicable

Thanks! @AlB @amitchandak 

AlB
Community Champion
Community Champion

@Anonymous 

Ok, then you just need  TOPN(1,...   instead of TOPN( 2,...

 

 

Top Prog =
CONCATENATEX (
    TOPN (
        1,
        DISTINCT ( Program[Programme Name] ),
        [Total no of program attendees], DESC
    ),
    Program[Programme Name],
    ", "
)

 

 

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

AlB
Community Champion
Community Champion

Hi @Anonymous 

Try this:

Top 2 Prog =
CONCATENATEX (
    TOPN (
        2,
        DISTINCT ( Program[Programme Name] ),
        [Total no of program attendees], DESC
    ),
    Program[Programme Name],
    ", "
)

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Anonymous
Not applicable

@AlB 

THanks it works! But as for the case where there is only 1 program with the highest no of attendees, I just would need only 1 program name that will be displayed. If there are any other 2 programs with the same highest no of attendees, then I will need 2 programs to be displayed. 

 

Currently, based on your solution, I have 2 different program names with different no of attendees. But I would want only 1 program name if there is no other program with the same highest no of attendees.

 

Case 1:

Program A: 100 people

Program B: 90 people

 

Then the card should show "Program A"

 

Case 2

Progam A: 100 people

Program B: 100 people

 

Then the card should show " Program A, Program B"

Thanks!

amitchandak
Super User
Super User

@Anonymous ,

Try like example

Top 1Rank = CALCULATE(max(Program[Program Name]),TOPN(1 ,all(Program[Program Name]),[Sales],DESC),VALUES(Program[Program Name]))

 

https://www.youtube.com/watch?v=QIVEFp-QiOk

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

@amitchandak 

Thanks! It works. However in one of the FYs, I have more than 1 result that shows the highest no. How to display more than 1 result at the same time in the Card visualisation?

 

For example

 

"Program 1 & Program 2"

Most popular courses

@Anonymous , Try like

Top 2 Rank = CALCULATE(concatenatex(Program,Program[Program Name]),TOPN(2 ,all(Program[Program Name]),[Sales],DESC),VALUES(Program[Program Name]))

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

@amitchandak 

It works but the outcome is not quite right. 

When I select one FY, it shows that type of program name more than once. Even if there are two different programs that have the same highest no of attendees, it does not give me two different program names.

 

Top 2 Prog =
CALCULATE(CONCATENATEX(Program,Program[Programme Name]), TOPN(2,all(Program[Programme Name]),[Total no of program attendees], DESC), VALUES(Program[Programme Name]))

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors