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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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)))

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.