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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
IgorGershenson
Helper II
Helper II

Sumif equivalents in DAX for calculated columns

I want to create two calculated columns in my data. I want the first one to show the number of sites for each hospital system and the second to show the total number clients in that system. Here is a simple example below. In Excel I would use Sumif to create the last two columns but how do I do it using DAX for calculated columns. I need these columns to create additional columns and measures later on.  Please help.

Health SystemSitesCount of SitesCustomer StatusCount of customersTotal Number of Sites in Health SystemTotal Number of Customers in Health System
UMASSsite 11YES185
UMASSsite 21NO085
UMASSsite 31YES185
UMASSsite 41YES185
UMASSsite 51NO085
UMASSsite 61YES185
UMASSsite 71YES185
UMASSsite 81NO085
NYUsite A1YES143
NYUsite B1YES143
NYUsite C1NO043
NYUsite D1YES143
2 ACCEPTED SOLUTIONS
Nathaniel_C
Community Champion
Community Champion

Tot Num Customer = CALCULATE(COUNT(Health[Customer Status]),ALLEXCEPT(Health,Health[Health System]),Health[Customer Status] = "YES")



Tot Num of Sites = CALCULATE(Count(Health[Health System]),ALLEXCEPT(Health,Health[Health System]))

Tot num.PNG

Hi @IgorGershenson ,

I did these as measures, so you can drop them on the visual.  They match what you have posted.  Thanks for the clarity in your posting! The CALCULATE allows this measure to iterate through the whole table, and the ALLEXCEPT keeps the one variable the same. 

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

AlB
Community Champion
Community Champion

Hi @IgorGershenson 

 

Total Number of Sites in Health System =
CALCULATE (
    DISTINCTCOUNT ( Table1[ Sites] ),
    ALLEXCEPT ( Table1, Table1[Health System] )
)

 

Total Number of Customers in Health System =
CALCULATE (
    SUM ( Table1[ Count of Customers] ),
    ALLEXCEPT ( Table1, Table1[Health System] )
)

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

 

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

Hi @IgorGershenson 

 

Total Number of Sites in Health System =
CALCULATE (
    DISTINCTCOUNT ( Table1[ Sites] ),
    ALLEXCEPT ( Table1, Table1[Health System] )
)

 

Total Number of Customers in Health System =
CALCULATE (
    SUM ( Table1[ Count of Customers] ),
    ALLEXCEPT ( Table1, Table1[Health System] )
)

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

 

Nathaniel_C
Community Champion
Community Champion

Tot Num Customer = CALCULATE(COUNT(Health[Customer Status]),ALLEXCEPT(Health,Health[Health System]),Health[Customer Status] = "YES")



Tot Num of Sites = CALCULATE(Count(Health[Health System]),ALLEXCEPT(Health,Health[Health System]))

Tot num.PNG

Hi @IgorGershenson ,

I did these as measures, so you can drop them on the visual.  They match what you have posted.  Thanks for the clarity in your posting! The CALCULATE allows this measure to iterate through the whole table, and the ALLEXCEPT keeps the one variable the same. 

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.