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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Spencer
Helper II
Helper II

Simple Sum Filter

Hi

 

If I have a dataset like the following:

Status         Qty

P                   10

P                   20

M                  50

M                  30

C                   25

C                   20

D                   15

 

What would be the formula for a measure that calculates the total Qty excluding those with the status of C or D.

I'd like to be able to apply the same sort of concept but with many various status' and only have a few be excluded. 

 

Thanks

1 ACCEPTED SOLUTION

Assuming your table is called "Table":

 

Measure = CALCULATE(SUM('Table'[QTY]);'Table'[Status]<>"C";'Table'[Status]<>"D")

 

CALCULATE() allows multiple filters

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi Spencer,

 

SanderBeukers’s reply seems well, you could also use below measures:

 

Total Qty without CD = SUMX(FILTER(ALL(Test),AND([Status]<>"C",[Status]<>"D")),[Qty])

 

Sum Except CD = CALCULATE(SUM([Qty]),FILTER(ALL(Test),AND([Status]<>"C",[Status]<>"D")) )

 

Result: (It have added two columns to display the measures)

 Capture.PNG

Notice: my test table is ‘test’, you can modify it to your table name.

 

Regards,

Xiaoxin Sheng

I might try that method in the future @Anonymous. Thankyou very much for the reply.

Douwe
Helper I
Helper I

Something like this should work:

 

Sum = CALCULATE(SUM(Qty);FILTER(Status=C))

Thanks for the reply @Douwe but I don't think that will filter out the D's as well.

Extend it like this: Sum = CALCULATE(SUM(Qty);FILTER(Status<>"C" || Status<>"D"))

Assuming your table is called "Table":

 

Measure = CALCULATE(SUM('Table'[QTY]);'Table'[Status]<>"C";'Table'[Status]<>"D")

 

CALCULATE() allows multiple filters

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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