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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Pbiuserr
Post Prodigy
Post Prodigy

Syntax issue with TOPN argument TABLE

Hello.
I have a measure which retrive name of category which has max [Change] value. I'd like to add another dimension to that - not only category, but also a gender and filter it to be female. so for instance out of gender (female), category 2 has max value, so output should be: category2

TOP cat name =
VAR _top_name = FIRSTNONBLANK(TOPN(1,VALUES(FctTable[Category]),[Change]),1)
RETURN
_top_name

it gives me name associated with max value when it concerns only one dimension - category. I'd like to add filter context of gender and only females Tried to ADDCOLUMNS inside TOPN but it didnt work.

Perhaps it should have other approach? Any ideas and tips are welcome
1 ACCEPTED SOLUTION

I've resolved my problem by using formula

 

CALCULATE( MAX(FctTable[Category]), TOPN(1, FILTER( SUMMARIZE (FctTable, FctTable[Gender], FctTable[Category], "@Chng", [Change]), FctTable[Gender] = "Female"), ABS([Change])) )

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Pbiuserr , Not very clear, check if one of the two can help

 

calculate(max(FctTable[Category]) ,TOPN(1,allselected(FctTable[Category]),[Change]), values(FctTable[Category]))

 

or

 

calculate([Change] ,TOPN(1,allselected(FctTable[Category]),[Change]), values(FctTable[Category]))

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

Hi Amit
I'd like to create such table virtually and retrive "Category" with max value for gender = "Female". "Change" is a measure, not column if it helps

Capture.PNG

I've resolved my problem by using formula

 

CALCULATE( MAX(FctTable[Category]), TOPN(1, FILTER( SUMMARIZE (FctTable, FctTable[Gender], FctTable[Category], "@Chng", [Change]), FctTable[Gender] = "Female"), ABS([Change])) )

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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