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
Prabhu_PowerBI
Regular Visitor

Measure to display Top 3 project names with highest Headcount in the dynamic text box

Dear Team,

 

I'm pretty new to Power BI platform. Need your input to create the DAX measure to fetch the Top 3 projects with highest Headcount. This name of the project to be displayed in the dyanmic text box. Appreciate your input.

 

Project Name      Headcount

Project A              10000

Project B              12000

Project C              11000

Project D              8000

Project E               7000    

 

Answer should be

 

Project with top three headcounts are Project C(11000), Project B(12000) and Project A(10000).  This text should be displayed in the Text box as per the Slicer selection.

 

Many Thanks

Prabhu

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Prabhu_PowerBI ,

You can add these measures below:

Top3 = 
VAR _rank =
    RANKX ( ALL ( 'Table' ), CALCULATE ( MAX ( 'Table'[Headcount] ) ),, DESC )
VAR _result1 =
    IF ( _rank <= 3, SELECTEDVALUE ( 'Table'[Project Name] ), BLANK () )
VAR _result2 =
    IF ( _rank <= 3, SELECTEDVALUE ( 'Table'[Headcount] ), BLANK () )
RETURN
    IF ( _rank <= 3, _result1 & "(" & _result2 & ")", BLANK () )
TEXT = 
CONCATENATE (
    "Project with top three headcounts are:",
    CONCATENATEX ( 'Table', [Top3] )
)

Final output:

vyifanwmsft_0-1715758505990.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

6 REPLIES 6
Anonymous
Not applicable

Hi @Prabhu_PowerBI ,

You can add these measures below:

Top3 = 
VAR _rank =
    RANKX ( ALL ( 'Table' ), CALCULATE ( MAX ( 'Table'[Headcount] ) ),, DESC )
VAR _result1 =
    IF ( _rank <= 3, SELECTEDVALUE ( 'Table'[Project Name] ), BLANK () )
VAR _result2 =
    IF ( _rank <= 3, SELECTEDVALUE ( 'Table'[Headcount] ), BLANK () )
RETURN
    IF ( _rank <= 3, _result1 & "(" & _result2 & ")", BLANK () )
TEXT = 
CONCATENATE (
    "Project with top three headcounts are:",
    CONCATENATEX ( 'Table', [Top3] )
)

Final output:

vyifanwmsft_0-1715758505990.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

Anonymous
Not applicable

Thanks @lbendlin  and @ExcelMonke  for their prompt replies. I believe their reply is helpful to you.
Hi @Prabhu_PowerBI ,
Based on the information you provided, I have created a sample data, you can add a new measure:

Top3 = 
VAR _rank =
    RANKX ( ALL ( 'Table' ), CALCULATE ( MAX ( 'Table'[Headcount] ) ),, DESC )
VAR _result1 =
    IF ( _rank <= 3, SELECTEDVALUE ( 'Table'[Project Name] ), BLANK () )
VAR _result2 =
    IF ( _rank <= 3, SELECTEDVALUE ( 'Table'[Headcount] ), BLANK () )
RETURN
    IF ( _rank <= 3, _result1 & "(" & _result2 & ")", BLANK () )

 

Final output:

vyifanwmsft_0-1715070755212.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

 

Hi Ada Wang, Ibendlin, ExcelMonke,

 

Many Thanks for your response. I'm trying to pass the top 3 project names as input to the text box to provide insights to the client. Within the Text box, the below summary should appear:

 

"Project with top three headcounts are Project C(11000), Project B(12000) and Project A(10000)".

 

Using the below Measure, i'm able to fetch the project with highest headcount; however I'm facing challenges to fetch the second and third highest headcount project names.

 

Top_Project_HC =
TOPN(
    1,
    VALUES('Table Name'[Project Name]),
    [Count_of_HC]
)
 
Appreciate your support.
 
Many Thanks,
Prabhu

Change to TOPN(3,...) and then use CONCATENATEX.

lbendlin
Super User
Super User

use TOPN and CONCATENATEX.

ExcelMonke
Super User
Super User

Hello, 
Consider the following measure: 

Top3 =
RANKX(
FactTable,
FactTable[Headcount],
DESC
)

Then create a table with your two columns (Project and Headcount). Whilst your table is selected, add this measure to the "Filters on this Visual" portion of the filters pane, and filter to the measure is equal or less than "3"





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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