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
garynorcrossmmc
Advocate IV
Advocate IV

Narrative Measure Not Matching Correctly

Hi all,

I have this table of values:

garynorcrossmmc_0-1726075527083.png
You'll see that the highlighted value of 20 for the Function 'Executive Assistants' is the highest value in the table.  I'm using the following metric to calculate the amount of the 'Employees - Receiving Special Bonus' that correspond with the value of the highest function of Executive Assistants for 2024:

Colleagues (Receiving Special Bonus) - Top Function # (TOPN) =
CALCULATE(
[Employees - Receiving Special Bonus],
TOPN ( 1, VALUES ( 'OWG Comp Listing'[Function] ), [Employees - Receiving Special Bonus], DESC ),
'OWG Comp Listing'[Year]=2024
)+0


Supporting Measures:

Employees - Receiving Special Bonus =
CALCULATE(
[Employees],
'OWG Comp Listing'[Special Bonus Amount]>0
)

 

Employees =
DISTINCTCOUNT('OWG Comp Listing'[Employee ID])

 

Special Bonus Amount =
DIVIDE(
SUM('OWG Comp Listing'[Special Bonus Amount]),
SELECTEDVALUE('Exchange Rates'[Year-End FX Rate]),
0
)

For some reason, the 'Colleagues (Receiving Special Bonus) - Top Function # (TOPN)' measure is returning an incorrect amount of 13.  What am I doing wrong here that I am not getting the correct number of 20?  Oddly enough, this method is working correctly elsewhere in the file.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @garynorcrossmmc 

 

You can try the following methods.

Measure = MAXX(ALL('Table'),[Employees - Receiving Special Bonus])

vzhangtinmsft_0-1726123454694.png

Is this the result you expected?

 

Best Regards,

Community Support Team _Charlotte

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

4 REPLIES 4
Anonymous
Not applicable

Hi, @garynorcrossmmc 

 

You can try the following methods.

Measure = MAXX(ALL('Table'),[Employees - Receiving Special Bonus])

vzhangtinmsft_0-1726123454694.png

Is this the result you expected?

 

Best Regards,

Community Support Team _Charlotte

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

Thanks, @Anonymous!  This appears to now be returning the correct calculation with a slight modification:

Colleagues (Receiving Special Bonus) - Top Function # (TOPN) = 
MAXX(ALLSELECTED('OWG Comp Listing'[Function]),CALCULATE([Employees - Receiving Special Bonus],'OWG Comp Listing'[Year]=2024))+0
rajendraongole1
Super User
Super User

Hi @garynorcrossmmc - First, check that the granularity of the data is consistent with how you are trying to calculate the top value. If there are duplicates or variations in other columns, the TOPN may behave unexpectedly.

Modified measure:

 

Colleagues (Receiving Special Bonus) - Top Function # (TOPN) =
VAR TopFunction =
TOPN (
1,
SUMMARIZE(
'OWG Comp Listing',
'OWG Comp Listing'[Function],
"TotalEmployees", [Employees - Receiving Special Bonus]
),
[TotalEmployees],
DESC
)
RETURN
CALCULATE(
[Employees - Receiving Special Bonus],
FILTER(
'OWG Comp Listing',
'OWG Comp Listing'[Function] IN TopFunction &&
'OWG Comp Listing'[Year] = 2024
)
) + 0

 

 

Hope this helps.





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

Proud to be a Super User!





Thanks for the reply, @rajendraongole1!  I'm receiving this error from the calc, do you have any recommendation on how to get around this?

The number of arguments is invalid. Function CONTAINSROW must have a value for each column in the table expression.

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.