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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sridharkrish
New Member

Regarding Max Condition with multiple condition

Hi All,
I have a table consisting of name, CRM number and a phase where I need to find the max value of the CRM number. I have three conditions here : I want DAX in PowerBi.
If a name has only agreements in the phase then the max value should be of the highest CRM number in agreement.
If a name consists of agreements, quotes and leads then also the max value should be of the highest CRM number in agreement.
If a name doesnt have any agreements but has leads and quotes then the CRM should of the highest CRM number.

I have tried many methods but couldnt find any solution please help me in this regard and its urgent !!
I have attached a snap of the example, please have a look at it how the result should look !!

Sridharkrish_0-1670571915669.png

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Sridharkrish 

 

try to add a column with this:

MaxValue =
VAR _MaxValue1 =
CALCULATE(
    MAX(TableName[CRM]),
    ALLEXCEPT(TableName, TableName[Name])
)
VAR _MaxValue2 =
CALCULATE(
    MAX(TableName[CRM]),
    ALLEXCEPT(TableName, TableName[Name]),
    TableName[Phase]="Agreement"
)
RETURN
    IF(
        _MaxValue2<>0,
        IF(TableName[CRM]=_MaxValue2, "MAX"),
        IF( TableName[CRM]=_MaxValue1, "MAX")
    )
 
i tried and it worked like this:
FreemanZ_1-1670574576119.png

 


 

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @Sridharkrish 

 

try to add a column with this:

MaxValue =
VAR _MaxValue1 =
CALCULATE(
    MAX(TableName[CRM]),
    ALLEXCEPT(TableName, TableName[Name])
)
VAR _MaxValue2 =
CALCULATE(
    MAX(TableName[CRM]),
    ALLEXCEPT(TableName, TableName[Name]),
    TableName[Phase]="Agreement"
)
RETURN
    IF(
        _MaxValue2<>0,
        IF(TableName[CRM]=_MaxValue2, "MAX"),
        IF( TableName[CRM]=_MaxValue1, "MAX")
    )
 
i tried and it worked like this:
FreemanZ_1-1670574576119.png

 


 

Thank you very much for your help. It got solved !!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.