Forum

SUMIF equivalent in...
 
Notifications
Clear all

SUMIF equivalent in measures

2 Posts
2 Users
0 Reactions
282 Views
(@baxbax)
Posts: 125
Estimable Member
Topic starter
 

Hi,

I have a table of data that basically shows invoice lines. Each line has a sales value. I want to add a field that adds up all of the invoice lines and shows the total value on each row. 

The following is a simple example:

Invoice No Turnover Invoice Total

ABC123     £100.00   £450.00 

ABC123     £150.00   £450.00

ABC123     £200.00   £450.00

In Excel it would be easy to do this by using either SUMIF or SUMIFS.

How would I achieve the same using a measure in Power Pivot? I have attached a file that has some sample data in it. 

Thanks

 

Bax

 
Posted : 25/10/2023 8:07 am
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

I had to Google a bit and learned something of it myself and came across the following post:

Solved: Re: DAX equivalent of =sumifs, based on row contex... - Microsoft Fabric Community

 

You can add the calculated column to your table with the following DAX expression:

=CALCULATE(SUM(Table_Data[Turnover]),FILTER(Table_Data,Table_Data[Sales Invoices] = EARLIER(Table_Data[Sales Invoices])))

 

Another one could be:

=SUMX(FILTER(Table_Data,Table_Data[Sales Invoices] = EARLIER(Table_Data[Sales Invoices])),Table_Data[Turnover])

Thanks for asking!

 
Posted : 25/10/2023 9:16 am
Share: