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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors