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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
hello_
Helper I
Helper I

Measure that returns the Max value by multiple catagories

hello__0-1705299841517.png

 

 

Hello Authors I am in a bite of bind please help I want to make a DAX Measure that returns the top or MAX value only by that categories please Guide me 

 

Thank You 

1 ACCEPTED SOLUTION
v-kaiyue-msft
Community Support
Community Support

Hi @hello_ ,

 

Please follow these steps:

1.You can create a new metric and write the following expression.

Measure =

var _max_cou =

MAXX(

    FILTER(

        ALL('Table'),

        'Table'[Category_1]=MAX('Table'[Category_1])&&'Table'[Category_2]=MAX('Table'[Category_2])),

    [Count_Category])

RETURN

IF(MAX('Table'[Count_Category]) = _max_cou,

_max_cou,

BLANK()

)

vkaiyuemsft_0-1705395934480.png

2.The results obtained are shown below.

vkaiyuemsft_1-1705396097670.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

4 REPLIES 4
hello_
Helper I
Helper I

Thank You very much 

 

v-kaiyue-msft
Community Support
Community Support

Hi @hello_ ,

 

Please follow these steps:

1.You can create a new metric and write the following expression.

Measure =

var _max_cou =

MAXX(

    FILTER(

        ALL('Table'),

        'Table'[Category_1]=MAX('Table'[Category_1])&&'Table'[Category_2]=MAX('Table'[Category_2])),

    [Count_Category])

RETURN

IF(MAX('Table'[Count_Category]) = _max_cou,

_max_cou,

BLANK()

)

vkaiyuemsft_0-1705395934480.png

2.The results obtained are shown below.

vkaiyuemsft_1-1705396097670.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

 

Thank You Sir for the solution it helps 🙏😊

123abc
Super User
Super User

Certainly! In Power BI, you can create a DAX measure to return the maximum value by multiple categories. Assuming you have a table with the relevant data, and you want to find the maximum value based on certain categories, you can use the following DAX formula as an example:

 

MaxValueByCategory =
CALCULATE(
MAX('YourTableName'[YourNumericColumn]),
ALLEXCEPT('YourTableName', 'CategoryColumn1', 'CategoryColumn2', ...)
)

 

Here, replace 'YourTableName' with the actual name of your table, 'YourNumericColumn' with the column containing the values you want to find the maximum of, and 'CategoryColumn1', 'CategoryColumn2', etc., with the columns representing your categories.

The ALLEXCEPT function removes all filters from the table except for the specified columns, ensuring that the maximum is calculated within the selected categories.

For example, if you have a Sales table with columns 'Product', 'Region', and 'SalesAmount', and you want to find the maximum sales amount by product and region, the formula would look like this:

 

MaxSalesByProductAndRegion =
CALCULATE(
MAX('Sales'[SalesAmount]),
ALLEXCEPT('Sales', 'Product', 'Region')
)

 

Adjust the column names based on your specific dataset and requirements. If you have more than two categories, include additional columns within the ALLEXCEPT function.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.