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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
eden
Helper I
Helper I

Report: How to display TOP 5 Result based on Status ?

Hello 

i got a sharepoint list similar to follows 

 

WorkorderStatuscustomer start date
Onepublishedabc01/08/2020
tworevieweddef24/09/2020
threewaitingxyz17/09/2020
fourdeferedabc 01/12/2020
fivepublishedoiu01/07/2020
sixin progressabc 22/05/2019
sevenin progressdef21/07/2019
eightin progresskjs21/08/2019

 

I am trying to display something like below in Power BI for top 4 customers whose status is not published

 

pivot.JPG

 

The chart is displaying properly but  i cannot restrict the top 4 customers as all the customers are diplaying in the report

 

Regards

12 REPLIES 12
Fowmy
Super User
Super User

@eden 

Try this measure please

Top4 = 
IF( 
    RANKX( 
        ALLSELECTED('Table'[customer ]),
        CALCULATE(
            COUNTROWS('Table'),
            'Table'[Status] <> "published"
        ),,
        DESC) <5, 
    CALCULATE(
        COUNTROWS('Table'),
        'Table'[Status] <> "published"
    ),
    BLANK()
)

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

How to use the below solutution 

 

Axis : Customer 

Value : Top 4

 

 

@eden 

Yes, you are right.

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy 

 

Its not doing for me .. i am getting something like below

 

bi p.JPG

 

settings

bi.JPG

@eden 

You may have more than one customer who falls into the top 4. If you have two customers who are ranked top one, they both come.

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy 

 

that can be the case.

how to filter them based on any other criteria.. We can use start date , that whoever has early entry can be displayed in the chart

@eden

I gave you the solution based on the sample data you shared and there was no date column to be included in the rank. Share a propper sample and show the expected output.

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy 

 

My intention was to filter the top 5 records based on their weightage in my whole table.. If two records carry same weightage we can use someother field to decide the winner.. 

 

Here we can use start date as a criteria  as early start date will have highest priority in the chart

 

I am expecting something like below, Customer XYZ is not eligible as OIU,KJS as earlier start date

 

bi dd.JPG

 

@Fowmy 

 

table updated with date 

Anonymous
Not applicable

Hi @eden 

I build a table like yours to have a test.

1.png

I build calculated columns to achieve your goal.

 

Count = CALCULATE(count('Table'[customer ]),FILTER('Table','Table'[customer ]=EARLIER('Table'[customer ])))
Laststatus = CALCULATE(MAX('Table'[Status]),FILTER('Table','Table'[customer ]=EARLIER('Table'[customer ])&&'Table'[start date]='Table'[MAXdate]))
MAXdate = MAXX(FILTER('Table','Table'[customer ]=EARLIER('Table'[customer ])),'Table'[start date])
New Value = 
Var _rank2 = RANKX('Table','Table'[MAXdate],,DESC,Dense)
Var _Newvalue = 'Table'[Count]+_rank2*0.0001
return
_Newvalue
Rank = 
Var _Rank = RANKX(FILTER('Table','Table'[customer ]<>"oiu"),'Table'[New Value],,DESC,Dense)
Var _NewRank = IF( 'Table'[Laststatus]<>"published",_Rank,10000)
Return
_NewRank

 

New Table:

2.png

 Build Maxdate and Laststatus columns to get the maxdate and laststatus to each customer. Then build a rank column by new value, and let the customer whose laststatus = publish show 10000 in rank.

Result:

3.png

You can download the pbix file from this link: Report: How to display TOP 5 result based on status?

 

Best Regards,

Rico Zhou

 

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

@Anonymous 

good one .. I will test my side .

 

I got one more question, In your Ranking ,wat if the customer name  is dynamic ,the customer name can change from the front dynamically and ranking also needs to be changed accordingly

 

Here the customer oiu priority can be changed..how does that  going to work.

Var _Rank = RANKX(FILTER('Table','Table'[customer ]<>"oiu"),'Table'[New Value],,DESC,Dense)

 

Anonymous
Not applicable

Hi @eden 

I add some values into the table.

1.png

In this table oiu and ztw 's laststatus = published.

Change the Rank column:

Rank = 
VAR _Totaladd1 =
    DISTINCTCOUNT ( 'Table'[customer ] ) + 1
VAR _Rank =
    RANKX (
        FILTER ( 'Table', 'Table'[Laststatus] <> "published" ),
        'Table'[New Value],
        ,
        DESC,
        DENSE
    )
RETURN
    IF ( 'Table'[Laststatus] = "published", _Totaladd1, _Rank )

Result:

2.png

3.png'

You can download the pbix file from this link: Report: How to display TOP 5 result based on status?

 

Best Regards,

Rico Zhou

 

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors