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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors