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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
moeconsult
Helper V
Helper V

IF AND SUMIF OR

I have the below formula in excel but I need help to write same formular in DAX

=IF(AND(SUMIF(A:A,A2,B:B)

>=10,C2="face"),"Eng"

,IF(AND(SUMIF(A:A,A2,B:B)

>=20,OR(C2="face",C2="online")),"PS"

,IF(AND(D2="pass",E2="CS" ),"Up","Unknown")))

 

Please see sample data below 

 

NamehoursmethodstatuspriorityResult Output
Ade-15facepassCSUp
Ade5facepassCSUp
ade5facepassCSUp
Ade5facepassCSUp
Ade5onlinepasscsUp
Alex5facepasscsEng
Alex5face csEng
Alex5online csPS
Alex5online csPS
Alex5online csPS
Alex5online csPS
Alex5face CS Eng
Chris5facefailwweeeEng
chris5facefailwweeeEng
chris5facefailwweeeEng
Chris5onlinefailwweeePS
chris5onlinefailwweeePS
chris5onlinefailwweeePS
Chris5onlinefailwweeePS
chris5facefailwweeeEng
chris5facefailwweeeEng
Ola5facefailwweeeEng
ola5facefailwweeeEng
Tobi5onlinefailwweeePS
tobi5facefailwweeeEng
tobi10facefailwweeeEng

 

Thanks

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=if(AND(CALCULATE(SUM(Data[hours]),FILTER(Data,Data[Name]=EARLIER(Data[Name])))>=10,Data[method]="face"),"Eng",IF(AND(CALCULATE(SUM(Data[hours]),FILTER(Data,Data[Name]=EARLIER(Data[Name])))>=20,OR(Data[method]="online",Data[method]="face")),"PS",IF(AND(Data[status]="pass",Data[priority]="CS"),"Up","Unknown")))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

@moeconsult - I did find one slight error in @Anonymous's formula so I corrected it and did some formatting. PBIX is attached.

 

Result Output = 
    VAR __Sum = SUMX(FILTER(ALL('Table'),[Name]=EARLIER([Name])),[hours])
RETURN
    SWITCH(
        TRUE(),
        __Sum >= 10 && [method]="face","Eng",
        __Sum >= 20 && ([method]="face" || [method]="online"),"PS",
        [status] = "pass" && [priority] = "CS","Up",
        "Unknown"
    )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

19 REPLIES 19

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.