SUMIF as DAX measure

serky

New Member
Joined
Jun 30, 2014
Messages
39
Hi

can someone advise how to execute a calculation over a subset of rows only?

In my case, I have a table that lists customers and their individual sales. I need a dynamic measure that loops over each customer, and adds their sales to give a total figure.

Example -

Customer, Sale, Total Sale
Jane, 1, 10
Fred, 2, 3
Tom, 1, 1
Jane, 9, 10
Fred, 1,3

I need a measure not a calculated column.

Thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Ok - I have finally found an answer to this. Posted it below to help others.

Total sales:= CALCULATE(SUM(Table[Sale]),
ALLEXCEPT(Table, Table[Customer]))

Kudos to Zubair_Muhammad and their post: https://community.powerbi.com/t5/De...another-column-based-on-row-value/td-p/374445

There is also a reference to this function: https://www.sqlbi.com/articles/managing-all-functions-in-dax-all-allselected-allnoblankrow-allexcept...

though more than happy for someone to add their explanation re how this works.
 
Upvote 0
I would like to extend this questions further. I now need another SUMIF to consider both a column in the table and the result of a measure eg - I want to know the total sales for each person for a given supervisor (the supervisor can change with different shifts). The supervisor is determined by a measure.

Example -

CustomerSaleSupervisorTotal Sale
Jane1Jack1
Fred2Jack3
Tom1Jack1
Jane9Henry11
Fred1Jack3
Jane2Henry11

<colgroup><col width="65" span="4"> </colgroup><tbody>
</tbody>
<style> <!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";} .font5 {color:windowtext; font-size:8.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Arial; mso-generic-font-family:auto; mso-font-charset:0;} td {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Arial; mso-generic-font-family:auto; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;} .xl24 {text-align:center; border-top:.5pt hairline windowtext; border-right:.5pt solid windowtext; border-bottom:.5pt hairline windowtext; border-left:.5pt solid windowtext;} .xl25 {text-align:center; border-top:.5pt hairline windowtext; border-right:.5pt solid windowtext; border-bottom:.5pt solid windowtext; border-left:.5pt solid windowtext;} .xl26 {text-align:center; border-top:none; border-right:.5pt solid windowtext; border-bottom:.5pt hairline windowtext; border-left:.5pt solid windowtext;} .xl27 {font-weight:700; text-align:center; border:.5pt solid windowtext;} ruby {ruby-align:left;} rt {color:windowtext; font-size:8.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Arial; mso-generic-font-family:auto; mso-font-charset:0; mso-char-type:none; display:none;} --> </style>
I have tried a couple of variations to the formula above but it's not quite working.

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,108
Messages
6,123,129
Members
449,097
Latest member
mlckr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top