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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Max per category dependent on filter

Hope someone can assist.

 

I want to be able to see the max index per category (in my example, Entry_No) but I want this to dynamically calulcate based on a date slicer.

 

The measure I am using currently is as below:

MaxIndex = 
    CALCULATE(
        MAX('Table'[Index]),
        ALLEXCEPT('Table', 'Table'[Entry_No])
        )

 

Here it's working as expected:

jordanshep_0-1673454560107.png


But when I change the date slicer:

jordanshep_1-1673454587647.png

I want this second example to show MaxIndex as 1 as that's the max index for the date slicer provided. I think it's due to me using ALLEXCEPT in my measure, I've tried playing with different variations of ALL but can't seem to get it working. Anyone able to assist?

2 ACCEPTED SOLUTIONS
FreemanZ
Super User
Super User

hi @Anonymous 

try like:

try like:
MaxIndex =
VAR _entry = MAX('table'[Entry_No]
RETURN
MAXX(
    FILTER('Table', 'Table'[Entry_No]=_entry),
    'Table'[Index])
)

View solution in original post

v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your description, you want to get the max Index  and it can work on the date slicer.

Here are the steps you can refer to :

(1)This is my test data:

vyueyunzhmsft_0-1673489256599.png

(2)We can create  a  measure like this:

MaxIndex = var _cur_No  =  MAX('Table'[Entry_No])
var _t = FILTER( ALLSELECTED('Table') , 'Table'[Entry_No]=_cur_No)
return
MAXX(_t , [Index])

(3)Then we can meet your need , the result is as follows:

vyueyunzhmsft_1-1673489294825.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

7 REPLIES 7
Anonymous
Not applicable

.

v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your description, you want to get the max Index  and it can work on the date slicer.

Here are the steps you can refer to :

(1)This is my test data:

vyueyunzhmsft_0-1673489256599.png

(2)We can create  a  measure like this:

MaxIndex = var _cur_No  =  MAX('Table'[Entry_No])
var _t = FILTER( ALLSELECTED('Table') , 'Table'[Entry_No]=_cur_No)
return
MAXX(_t , [Index])

(3)Then we can meet your need , the result is as follows:

vyueyunzhmsft_1-1673489294825.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Anonymous
Not applicable

Thanks Aniya, this worked a treat!

FreemanZ
Super User
Super User

hi @Anonymous 

try like:

try like:
MaxIndex =
VAR _entry = MAX('table'[Entry_No]
RETURN
MAXX(
    FILTER('Table', 'Table'[Entry_No]=_entry),
    'Table'[Index])
)
Anonymous
Not applicable

Thanks @FreemanZ this worked also!

vicky_
Super User
Super User

assuming linkdate is also in the same table, could you try add that to the ALLEXCEPT parameters? 

...  ALLEXCEPT('Table', 'Table'[Entry_No], 'Table'[LinkDate])
Anonymous
Not applicable

Thanks Vicky but unfortunately this didn't work for me, it didn't give the max index per my category (Entry_No) - the other solutions provided did work however, I needed to use variables. Thanks for your suggestion anyhow!

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors