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
cakarunkumar
New Member

Dax Formula for getting result based on sumx, filter and related

I have the following tables setup in the power BI 1) Day book - columns include date, ledger name, debit, credit, 2) running trial balance - columns include date, opening balance, Debit, Credit, Closing Balance , 3) Calendar - Date, Day. The relationship between these tables are setup as follows: Running trial balance to day book - 1 to many, day book to calendar- many to 1. Now i have a page slicer setup in my report page based on calendar month. i am trying to write a dax code to sum the total of debit and credits from the day book by looking up the ledger name and filtering upto the max date as available in the slicer. sumx with related and filter formula are not working. kindly suggest a dax code

1 REPLY 1
amitchandak
Super User
Super User

@cakarunkumar , If you join with a date table and simply SUM, it will work.

 

Or you will measure like

 

CALCULATE(firstnonblankvalue('Date'[Month]),sum(Table[opening balance]),filter(all(date),date[date] <=max(date[date]))) +
CALCULATE(SUM(Table[Credit]),filter(all(date),date[date] <=max(date[date]))) -
CALCULATE(SUM(Table[Debit]),filter(all(date),date[date] <=max(date[date])))

 

Power BI Inventory On Hand
Power BI Inventory On Hand: https://youtu.be/nKbJ9Cpb-Aw

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

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.

Top Solution Authors