cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
brett_walton Helper II
Helper II

Create a SUM measure that sums conditionally (based on a value in another column)

I have the following data in the same source

 

Status         Qty

P                   10

P                   20

M                  50

M                  30

C                  25

 

I want to create a messure that SUMs the qty's but only for status P. I know how to do it with a SUM and a filter on a viz but I was hoping to create a meassure as this type of calc will be used in many cards and other queries. '

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Sean Community Champion
Community Champion

Re: Create a SUM measure that sums conditionally (based on a value in another column)

@brett_walton

 

Measure = CALCULATE(SUM(TableName[Qty]), TableName[Status]="P")

 

Hope this helps!

View solution in original post

8 REPLIES 8
Sean Community Champion
Community Champion

Re: Create a SUM measure that sums conditionally (based on a value in another column)

@brett_walton

 

Measure = CALCULATE(SUM(TableName[Qty]), TableName[Status]="P")

 

Hope this helps!

View solution in original post

brett_walton Helper II
Helper II

Re: Create a SUM measure that sums conditionally (based on a value in another column)

It does , thanks for share with the beginner.

nehabarnwal
Regular Visitor

Re: Create a SUM measure that sums conditionally (based on a value in another column)

What if I wish to get the sum of quantity for P as well M status but not C? How should I do it?

nehabarnwal
Regular Visitor

Re: Create a SUM measure that sums conditionally (based on a value in another column)

What if I want to sum for more than one status? How do I do?

Colinu Helper I
Helper I

Re: Create a SUM measure that sums conditionally (based on a value in another column)

I have a simmilare issues 

 

what i would liek to do is show all values P, M, C in a chart and show the sum of all Qty assosated to them.

 

can this be done without having to create a Mesure for every Status?

mattniblett
Regular Visitor

Re: Create a SUM measure that sums conditionally (based on a value in another column)

@nehabarnwal @Colinu @brett_walton @Sean

 

You can try the following to Group By elements that are in your rows:

 

e.g. 

MyMeasureByGroup = 
CALCULATE(
SUM('MYTABLE'[COLUMN1]),
GROUPBY('MYTABLE', [COLUMN2])
)

 

AMF
New Member

Re: Create a SUM measure that sums conditionally (based on a value in another column)

Hi,

 

I have the following situation.

How could I sum the figures in column 2 by taking only one amount per each value in column 1?

By example, for value 3, I should have an average of the amounts displayed in column 2 and add it to the average amount for value 2 and so on.

 

 

Column 1 Column 2 
3          10,00 €
3          10,00 €
3          50,00 €
2          10,00 €
1            2,00 €
2            3,00 €
3          45,00 €

 

Thank you!

159585
New Member

Re: Create a SUM measure that sums conditionally (based on a value in another column)

i can't make this "Create a SUM measure that sums conditionally (based on a value in another column)" in if condition. could anyone Know the solution for this? Please share the syntax.


Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors