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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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