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
cottrera
Post Prodigy
Post Prodigy

DAX SUM based on multiple criteria

Hi 

 

I have a table called Activity which contains activity types and time associated.  I need to perform a sum based on 7 of these activity types

 

Table_Activity
ActivityTime_Mins
HOLIDAY300
SICK200
BANK_HOL400
WORKING40000
COLLECTION2000
TRAVEL15000
DOCTORS120
FLEET800
TRAINING1200
DEPOT100

 

Here are the results I would exspect

SUM (HOLIDAY,SICK,BANK_HOL,DOCTORS,TRAINING,DEPOT) =3120

 

thank you

RIchard

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

You can use the following measure for this:

Measure =
CALCULATE (
    SUM ( 'Table'[Time_Mins] );
    'Table'[Activity] <> "WORKING"
        && 'Table'[Activity] <> "COLLECTION"
)

 

Kind regards
Joren Venema

Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily. 

View solution in original post

Anonymous
Not applicable

@cottrera  - 

You could also add a Calculated Column to differentiate different groupings:

Category = 
IF(
   'Table'[Activity] IN {"HOLIDAY","SICK","BANK_HOL","DOCTORS","TRAINING","DEPOT"}, "In", "Out"
)

 Whether you use a grouping or not, you'll probably want to use a Slicer visualization:

Slicer.PNG

I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@cottrera  - 

You could also add a Calculated Column to differentiate different groupings:

Category = 
IF(
   'Table'[Activity] IN {"HOLIDAY","SICK","BANK_HOL","DOCTORS","TRAINING","DEPOT"}, "In", "Out"
)

 Whether you use a grouping or not, you'll probably want to use a Slicer visualization:

Slicer.PNG

I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.
Anonymous
Not applicable

You can use the following measure for this:

Measure =
CALCULATE (
    SUM ( 'Table'[Time_Mins] );
    'Table'[Activity] <> "WORKING"
        && 'Table'[Activity] <> "COLLECTION"
)

 

Kind regards
Joren Venema

Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily. 

Works fine thanks you your quick response

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.