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
mhicoayala
Frequent Visitor

SUMX not working (Opening & Closing Balance)

Hi,

I am trying to perform a SUMX with the measure below, and putting 'Month' filter in a Table so I can have the sum of all instances of 'Closing Balance', but it just doesn't seem to work:

 

Closing Balance = 

VAR _startOfTheMonth = STARTOFMONTH('Calendar'[Date])
VAR _endOfTheMonth = ENDOFMONTH('Calendar'[Date])

VAR _startBeginningPeriod = SUMX(Manpower,
                                IF(Manpower[Date Assigned To Current Project] <= _endOfTheMonth, 1, 0)
)

VAR _startEndPeriod = SUMX(Manpower,
                            IF(Manpower[Last Reporting Date / Resignation] <= _endOfTheMonth && NOT(ISBLANK(Manpower[Last Reporting Date / Resignation])), 1, 0)
)

RETURN
_startBeginningPeriod - _startEndPeriod

 

 
This is how it looks like:

Capture.PNG

 I'm really at an impasse here and I would appreciate it if you could answer this.

 

Thanks!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mhicoayala , Change return like this


Sumx(values(calendar[Month year]), _startBeginningPeriod - _startEndPeriod)

 

or create one more measure

Sumx(values(calendar[Month year]),[Closing Balance])

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@mhicoayala , Change return like this


Sumx(values(calendar[Month year]), _startBeginningPeriod - _startEndPeriod)

 

or create one more measure

Sumx(values(calendar[Month year]),[Closing Balance])

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

Oh my god thank you so much!!!! 

Helpful resources

Announcements
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.