cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

I might try that method in the future @v-shex-msft. Thankyou very much for the reply.

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

View solution in original post

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors