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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Cbishop
Frequent Visitor

SUMIFS function in Power BI

Hi,

 

I am stuck on how I can apply the following SUMIFS formula into Power BI

 

=E2/SUMIFS(E:E,A:A,A2,B:B,B2)*100

Re-worked with column names (=Cost 2020/21 - Plan/SUMIFS(Cost 2020/21 - Plan,Group,Group,Month,Month)*100)

 

Data table below:-

 

GroupMonthExp Group 2Cost 2020/21 - ActualsCost 2020/21 - Plan
GasAprClinical Supplies and Services31,53053,724
GasAprConsultants182,526210,190
GasAprDrugs175,677251,407
GasAprEstablishment & Transport2,0213,264
GasAprFinance Costs6,4316,038
GasAprJunior Medical97,30686,219
GasAprNon Clinical Staff73,78068,768
GasAprNon Clinical Supplies1,7812,619
GasAprNursing, Midwifery & HCA363,692417,645
GasAprOther Operating Expenses70,05552,771
GasAprPremises & Fixed Plant3,0091,630
GasAprPurchase of healthcare14,0621,155
GasAprSTT-2830
GasMayClinical Supplies and Services32,34562,255
GasMayConsultants187,249243,567
GasMayDrugs180,222291,329
GasMayEstablishment & Transport2,0733,782
GasMayFinance Costs6,5986,997
GasMayJunior Medical99,82499,910
GasMayNon Clinical Staff75,68979,688
GasMayNon Clinical Supplies1,8283,035
GasMayNursing, Midwifery & HCA373,103483,964
GasMayOther Operating Expenses71,86761,151
GasMayPremises & Fixed Plant3,0871,889
GasMayPurchase of healthcare14,4261,338
GasMaySTT-2900
SurAprClinical Supplies and Services72,14183,596
SurAprConsultants282,243327,062
SurAprDrugs337,590391,197
SurAprEstablishment & Transport4,3835,079
SurAprFinance Costs8,1089,395
SurAprJunior Medical115,775134,159
SurAprNon Clinical Staff92,342107,005
SurAprNon Clinical Supplies3,5174,075
SurAprNursing, Midwifery & HCA560,814649,868
SurAprOther Operating Expenses70,86182,113
SurAprPremises & Fixed Plant2,1892,536
SurAprPurchase of healthcare1,5511,797
SurAprSTT00
SurMayClinical Supplies and Services51,36281,560
SurMayConsultants297,340472,159
SurMayDrugs286,182454,439
SurMayEstablishment & Transport3,2925,228
SurMayFinance Costs10,47716,636
SurMayJunior Medical158,514251,711
SurMayNon Clinical Staff120,189190,853
SurMayNon Clinical Supplies2,9024,608
SurMayNursing, Midwifery & HCA592,464940,798
SurMayOther Operating Expenses114,121181,217
SurMayPremises & Fixed Plant4,9027,785
SurMayPurchase of healthcare22,90836,377
SurMaySTT-460-731

 

Many thanks in advance for any help

 

Craig

10 REPLIES 10
Cbishop
Frequent Visitor

Hi All,

 

Unfortunately all the suggestions didn't complete the required final result and as such I am unable to accept one as a solution.

 

I have managed to find a workaround to adhere to tight deadlines and will be revisiting this in due course.

 

Best Regards

 

Craig 

Anonymous
Not applicable

Hi @Cbishop 

Could you share your workaround and mark it as the solution? More people will benefit from it. 

Best Regards,

Rico Zhou

Anonymous
Not applicable

Hi @Cbishop 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

Anonymous
Not applicable

Hi @Cbishop 

Just like AllisonKennedy and  

I build a table like yours in power bi to have test.

2.png

I build a measure to calculate Cost2020/21-Plan / sum{Cost2020/21-Plan (group = group month = month) }*100:

 

Measure =
VAR _A =
    SUM ( 'Table'[Cost 2020/21 - Plan] )
VAR _B =
    SUMX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Group] = MAX ( 'Table'[Group] )
                && 'Table'[Month] = MAX ( 'Table'[Month] )
        ),
        'Table'[Cost 2020/21 - Plan]
    )
RETURN
    DIVIDE ( _A, _B ) * 100

 

Result:

1.png

If you want to calculate other like sum value filtered by (EXP Group 2 = EXP Group 2 and National Specialty = National Specialty and Month = Month).

You may refer to the formula _B in my measure, like :

 

_C =
SUMX (
    FILTER (
        ALL ( 'Table' ),
        'Table'[EXP Group2] = MAX ( 'Table'[EXP Group2] )
            && 'Table'[Month] = MAX ( 'Table'[Month] )
            && 'Table'[National Specialty] = MAX ( 'Table'[National Specialty] )
    ),
    Value
)

 

You can download the pbix file from this link: SUMIFS function in Power BI

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

Best Regards,

Rico Zhou

PaulDBrown
Community Champion
Community Champion

@Cbishop 

If I'm reading the formula correctly, you want to calculate the percentage of each planned cost over the total planned cost by group and month, right?

if so:

Planned cost over grouped planned cost =
VAR PlannedCost = SUM(table[Cost 2020/21 - Plan])

VAR GroupedPlannedCost = CALCULATE(PlannedCost, ALLEXCEPT(table, Table[group], table[month]))

RETURN

DIVIDE(PlannedCost, GroupedPlannedCost) * 100

 

PS, if you wish to display the value as a percentage, you don't need to mutliply by 100; just format the measure to display a percentage

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Apologies all, think I've confused matters by giving excel table not Power BI table.

 

Basically what I need to do is calculate the %age of plan for a different groups, the columsn in my Power BI table are:-

 

Month
Cost Centre
Expense Code
CC Description
EH Description
Description - NEW
Group
Divisional Grouping
CDG
National Specialty
Exp Group 2
I&E
Exp Group 4
NHSI Cat 1
Value

 

First calculation needs to be a SUM of the value column where EXP Group 2 = EXP Group 2 and National Specialty = National Specialty and Month = Month

 

This value to then be divided by sum of value column where National Specialty = National Specialty and Month = Month and colum I&E is either 'Pay' or 'Non Pay'

 

Thanks Craig

Hi,

Share the link from where i can download the PBI desktop file and show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
AllisonKennedy
Super User
Super User

@Cbishop

Generally speaking, you can achieve something similar to a SUMIFS using
Measure = Table[Cost 2020/21 - Plan] / SUMX(FILTER(ALL(Table), Table[Group] = SELECTEDVALUE{Table[Group]) && Table[Month] = SELECTEDVALUE(Table[Month]) ), Table[Cost 2020/21 - Plan] )

You could also look into using ALLEXCEPT in this case too as an alternative option.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

amitchandak
Super User
Super User

@Cbishop ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
refer if this cane help

https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390
Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

I need to take the value in column E and divide by the sum of Column E where the Group & month match, so on the first line of data, take the £53,724 divided by the sum of column E where column A = 'Gas' and column B = Apr

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.