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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
moeconsult
Helper V
Helper V

SUMS WITH MULTIPLESES CRITERIA

I need help with the DAX form of Excel formulas below as I've tried and no luck and could use some help please:

F2FA -SUMIFS(B:B,A:A,A2,C:C,"Att",D:D,"<>on pp")

In SUMIFS (B:B,A:A,A2,C:C,"Att",D:D, in pp")

F2FP -SUMIFS(B:B,A:A,A2,C:C,"Pen",D:D,"<>on pp")

Please see below my sample and output data:

A B C D

IdhoursstateguyF2FAin F2FP
A5thatgap4000
A5thatface4000
A5thatface4000
A5thatface4000
A5thatgap4000
A5thatface4000
A5thatgap4000
A5thatgap4000
B5thatface12000
B5thatgap12000
B5thatface12000
B5thatgap12000
B5thatface12000
B5thatface12000
B5thatface12000
B5thatgap12000
B5thatface12000
B5thatface12000
B5thatface12000
B5thatgap12000
B5thatface12000
B5thatgap12000
B5thatface12000
B5thatgap12000
B5thatface12000
B5thatface12000
B5thatgap12000
B5thatgap12000
B5thatgap12000
B5thatgap12000
B5thatgap12000
B5thatgap12000
C2.5featherRem2505
C2.5featherRem2505
C5thatone2505
C5thatgap2505
C5thatgap2505
C5thatgap2505
C5thatgap2505
D3featherRem1006
D3featherRem1006
D5thatgap1006
D5thatgap1006
E2.5featherRem10015.5
E2.5featherRem10015.5
E2.5featherRem10015.5
E3featherRem10015.5
E2.5featherRem10015.5
E2.5featherRem10015.5
E5thatgap10015.5
E5thatgap10015.5
F3featherRem3006
F3featherRem3006
F5thatgap3006
F5thatgap3006
F5thatgap3006
F5thatgap3006
F5thatgap3006
F5thatgap3006
G2.5featherRem2505
G2.5featherRem2505
G5thatone2505
G5thatgap2505
G5thatgap2505
G5thatgap2505
G5thatgap2505
H2featherRem002
I3featherRem8006
I3featherRem8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
I5thatgap8006
J2.5featherRem0010
J2.5featherRem0010
J2.5featherRem0010
J2.5featherRem0010
K2.5featherRem0010
K2.5featherRem0010
K2.5featherRem0010
K2.5featherRem0010
L3featherRem006
L3featherRem006
M5feathergap0010
M5feathergap0010
N5thatgap4000
N5thatgap4000
N5thatgap4000
N5thatgap4000
N5thatgap4000
N5thatgap4000
N5thatgap4000
N5thatgap4000
O5thatgap2500
O5thatgap2500
O5thatgap2500
O5thatgap2500
O5thatgap2500
P5feathergap3505
P5thatgap3505
P5thatgap3505
P5thatgap3505
P5thatgap3505
P5thatgap3505
P5thatgap3505
P5thatgap3505
Q5feathergap4005
Q5thatgap4005
Q5thatgap4005
Q5thatgap4005
Q5thatgap4005
Q5thatgap4005
Q5thatgap4005
Q5thatgap4005
Q5thatgap4005

@amitchandak

Thank you

1 ACCEPTED SOLUTION

OK @moeconsult using the pattern supplied previously, those would look like the following. You would put ID in a visual and then you could have these measures:

 

Sum att no pp =
  SUMX(
    FILTER(
      'Table',
      [Status] = "Att" && 
        [Type] <> "pp"
    ),
    [Hours]
  )

Sum att pp =
  SUMX(
    FILTER(
      'Table',
      [Status] = "Att" && 
        [Type] = "pp"
    ),
    [Hours]
  )


Sum pen no pp =
  SUMX(
    FILTER(
      'Table',
      [Status] = "Pen" && 
        [Type] <> "pp"
    ),
    [Hours]
  )

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Has your question been solved?


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

Yes thanks, I figured it out , sorry for the late reply

Greg_Deckler
Super User
Super User

Not overly up on my Excel macro language syntax but in general you use something like this as a replacement for SUMIF(S):

 

SUMX(FILTER('Table',[Column] = "Something" && [Column1] = "Something else"),[Some Other Column])

 

You can also use || or OR instead of && for AND.

 

Tough to say exactly I see the sample source data but I don't see expected result or logic (not in Excel macro language) of how to get from source data to result. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Basically, what I am trying to archieve is :

Sum of hours where status = "att" and type <> "on pp" by id

Sum of hours where status = "att" and type = "on pp" by id

Sum of hours where status = "pen" and type <> "on pp" by id

 

Output column is color coded

IDHoursStatusTypeF2FA On F2FP
A5AttGaP4000
A5AttFACE4000
A5AttFACE4000
A5AttFACE4000
A5AttGaP4000
A5AttFACE4000
A5AttGaP4000
A5AttGaP4000
B5AttFACE12000
B5AttGaP12000
B5AttFACE12000
B5AttGaP12000
B5AttFACE12000
B5AttFACE12000
B5AttFACE12000
B5AttGaP12000
B5AttFACE12000
B5AttFACE12000
B5AttFACE12000
B5AttGaP12000
B5AttFACE12000
B5AttGaP12000
B5AttFACE12000
B5AttGaP12000
B5AttFACE12000
B5AttFACE12000
B5AttGaP12000
B5AttGaP12000
B5AttGaP12000
B5AttGaP12000
B5AttGaP12000
B5AttGaP12000
C2.5PenRem2505
C2.5PenRem2505
C5AttOne2505
C5AttGaP2505
C5AttGaP2505
C5AttGaP2505
C5AttGaP2505
D3PenRem1006
D3PenRem1006
D5AttGaP1006
D5AttGaP1006
E2.5PenRem10015.5
E2.5PenRem10015.5
E2.5PenRem10015.5
E3PenRem10015.5
E2.5PenRem10015.5
E2.5PenRem10015.5
E5AttGaP10015.5
E5AttGaP10015.5
F3PenRem3006
F3PenRem3006
F5AttGaP3006
F5AttGaP3006
F5AttGaP3006
F5AttGaP3006
F5AttGaP3006
F5AttGaP3006
G2.5PenRem2505
G2.5PenRem2505
G5AttOne2505
G5AttGaP2505
G5AttGaP2505
G5AttGaP2505
G5AttGaP2505
H2PenRem002
I3PenRem8006
I3PenRem8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
I5AttGaP8006
J2.5PenRem0010
J2.5PenRem0010
J2.5PenRem0010
J2.5PenRem0010
K2.5PenRem0010
K2.5PenRem0010
K2.5PenRem0010
K2.5PenRem0010
L3PenRem006
L3PenRem006
M5PenGaP0010
M5PenGaP0010
N5AttGaP4000
N5AttGaP4000
N5AttGaP4000
N5AttGaP4000
N5AttGaP4000
N5AttGaP4000
N5AttGaP4000
N5AttGaP4000
O5AttGaP2500
O5AttGaP2500
O5AttGaP2500
O5AttGaP2500
O5AttGaP2500
P5PenGaP3505
P5AttGaP3505
P5AttGaP3505
P5AttGaP3505
P5AttGaP3505
P5AttGaP3505
P5AttGaP3505
P5AttGaP3505
Q5PenGaP4005
Q5AttGaP4005
Q5AttGaP4005
Q5AttGaP4005
Q5AttGaP4005
Q5AttGaP4005
Q5AttGaP4005
Q5AttGaP4005
Q5AttGaP4005

 

I hope this helps so you can help me 

@Greg_Deckler 

 

Thanks.

OK @moeconsult using the pattern supplied previously, those would look like the following. You would put ID in a visual and then you could have these measures:

 

Sum att no pp =
  SUMX(
    FILTER(
      'Table',
      [Status] = "Att" && 
        [Type] <> "pp"
    ),
    [Hours]
  )

Sum att pp =
  SUMX(
    FILTER(
      'Table',
      [Status] = "Att" && 
        [Type] = "pp"
    ),
    [Hours]
  )


Sum pen no pp =
  SUMX(
    FILTER(
      'Table',
      [Status] = "Pen" && 
        [Type] <> "pp"
    ),
    [Hours]
  )

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  Thanks for your help, I have third condition for the Measure but I was able to get it done with Dax below:

 

Sum att no pp = 
Calculate(
Sum('Table',[Hours]),
'Table',
[Status] = "Att",

'Table',
[Type] <> "pp",

'Table',

[Achieve]="Acce")

 Please let me know if you have any suggestion with the way have implemented this.

 

Regards

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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