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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Newbie12345
Regular Visitor

Urgent help on DAX - MAX index

Dear Power BI Pros,

I need your urgent help on finding the max value.

 

Newbie12345_0-1712479362660.png

 

I want to get the index of max KG.
KG is my measure.

Thank you!

2 ACCEPTED SOLUTIONS

Hi, @Newbie12345 

You can refer below link for error solving LINK 

View solution in original post

Dear @tamerj1 ,

Thank you so much for your response! 
KG is not a column, it is a measure, could pls you suggest me how to pass KG measure inside calculatetable.

View solution in original post

8 REPLIES 8
tamerj1
Super User
Super User

Hi @Newbie12345 

please try

Expected Output =
VAR T =
GENERATE (
VALUES ( 'Table'[Category] ),
CALCULATETABLE (
TOPN ( 1, SUMMARIZE ( 'Table', 'Table'[Kg], 'Table'[Index] ), 'Table'[Kg] ),
ALLEXCEPT ( 'Table', 'Table'[Category] )
)
)
RETURN
MAXX ( T, 'Table'[Index] )

Dear @tamerj1 ,

Thank you so much for your response! 
KG is not a column, it is a measure, could pls you suggest me how to pass KG measure inside calculatetable.

@Newbie12345 

Please try

Expected Output =
VAR T =
GENERATE (
VALUES ( 'Table'[Category] ),
CALCULATETABLE (
TOPN ( 1, SUMMARIZE ( 'Table', 'Table'[Index] ), [Kg] ),
ALL ( 'Table'[Index] )
)
)
RETURN
MAXX ( T, 'Table'[Index] )

Dear @tamerj1 ,

Thank you so much, I will try this.

AnalyticsWizard
Solution Supplier
Solution Supplier

@Newbie12345 

To find the index of the maximum value of a measure in Power BI, you can use the DAX function MAXX along with FILTER to iterate through the table and find the row with the highest ‘KG’ value. Here’s an example of how you might write this measure:

MaxKGIndex = 
VAR MaxKGValue = MAXX(ALL(Table1), [KG])
RETURN
CALCULATE(
    MIN(Table1[Index]),
    FILTER(
        ALL(Table1),
        [KG] = MaxKGValue
    )
)

This measure calculates the maximum ‘KG’ value across all rows in ‘Table1’ and then finds the corresponding ‘Index’ where this maximum value occurs. The ALL function is used to remove any filters that might limit the rows being evaluated. Remember to replace ‘Table1’ with the actual name of your table.

Please note that if there are multiple rows with the same maximum ‘KG’ value, this measure will return the smallest index among them. If you need further assistance or have more specific requirements, feel free to ask! 😊

Dear @AnalyticsWizard 
Thank you so much for your response. 
I tried it, unfortunately it is saying 'Visual is exceeded the available resourses' even after selecting single category.
Could you please help around with this?

Hi, @Newbie12345 

You can refer below link for error solving LINK 

Dear @Dangar332 ,

Thank you so much!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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