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

TOP 5 percentage Wrong output in Power BI

Hi Team,

I need TOP 5 Pecentage but its Wrong output

below is my table Name and Amount and I have calculated as GrandTotal but if select TOP 5 its Wrong Out put 2nd table is Output table

NameAmount%GT of Amount
H6021.05%
J5017.54%
I4014.04%
D3010.53%
F3010.53%
C207.02%
G207.02%
B155.26%
A103.51%
E103.51%

 

below is in Power BI out but its Wrong output

NameAmount%GT of Amount
H6028.57%
J5023.81%
I4019.05%
D3014.29%
F3014.29%

 

 

But I am epecting is below out

NameAmount%GT of Amount
H6021.05%
J5017.54%
I4014.04%
D3010.53%
F3010.53%

 

Thanks

Aruna lavi

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , If your % total correct,if so then use top N of rank on that to filter

example

Top 5 City Rank = CALCULATE([% of total],TOPN(10,all(Table[Name]),[% of tota],DESC),VALUES(Geography[Table]))

 

for % of total

divide(sum(Table[Amount]),calculate(sum(Table[Amount]),all(Table)))

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
FarhanAhmed
Community Champion
Community Champion

 

If you want to calculate percent with GrandTotal 

 

 

__Amount = CALCULATE(SUM(Subscription[Amount]),ALL(Subscription))

 

% Amount = SUM(Subscription[Amount])/[__Amount]

 

If you want external filters to be applied on your total Calcuation then you need to change your grand total formula to use ALLEXCEPT 

__Amount = CALCULATE(SUM(Subscription[Amount]),ALLEXCEPT(Subscription ,Subscription[UserID]))

 

and use % Amount same formula

 

 







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

Proud to be a Super User!




Anonymous
Not applicable

Hi Farhan,

Thank you replay.

but no lock if select TOP 5 its wrong percentage (if didnt select top N its give good result)

I am used your Measure given good result but its wrong showing after select TOP N

 

I am selecting TOPN in Power BI 

Select Filter panel

then Name expand Filter Type 

Then by values is %Amount 

 

its wrong Percentage

 

please help on this

 

Thanks

Aruna

 

Anonymous
Not applicable

Hi Team,

This  is Bug in Microsoft Power BI.I have tryed multiple ways but cant fixed(when we required %)

 

But I have fixed using sql server query and Powe BI(Both required)

Step 1(Sql server Query):

 query from DB: we create two extra column 1.Percentage and Rank 

Percentage query :CAST(100.0* [Amount] / (SUM([Amount]) OVER (PARTITION BY  h_Date )) AS DECIMAL(10,2)) AS %_Amount

Rank Function from DB:ROW_NUMBER() OVER( PARTITION BY h_Date ORDER BY [Amount] DESC) AS RowNumberRank

 

Step 2(Power BI):

I have create table for TOP N in Power BI below like

Then given Relationship Query dataset and TOP N  dataset(Step 1 and Step 2)

topN.PNG

 

if anybody any clarification please contact me.

Thanks

Shanvitha

Anonymous
Not applicable

Could you put the formula you're using? 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.