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
Ramachandran
Helper III
Helper III

TopN - Total value is not showing correctly

Hi,

I'm trying to get TopN total value based on TopN slicer selection.
My sample source data

Ramachandran_2-1653472688310.png

Suppose, I selected TopN value is 2 and I get 2 rows thats correct. Total row value is fetching overall value (10,500) but I want to Total value is only 5,500.

Anyone suggest me how to solve it.

 

Ramachandran_0-1653473905038.png

 

I used code is below,
New Amount =
SUMX(
TOPN(
'_TopN'[TOP_N_Value],
FILTER('Sample', 'Sample'[Active Flag] = 1),
'Sample'[Amount], DESC),
'Sample'[Amount]
)

 

thanks,

Ram

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Ramachandran , Try a measure like

 

calculate(sum('Sample'[Amount]), TOPN(
'_TopN'[TOP_N_Value], allselected('Sample'[Country]), 'Sample'[Amount], DESC), values('Sample'['Sample'[Country]),
FILTER('Sample', 'Sample'[Active Flag] = 1))

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Ramachandran , Try a measure like

 

calculate(sum('Sample'[Amount]), TOPN(
'_TopN'[TOP_N_Value], allselected('Sample'[Country]), 'Sample'[Amount], DESC), values('Sample'['Sample'[Country]),
FILTER('Sample', 'Sample'[Active Flag] = 1))

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.