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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dBrand
Frequent Visitor

Getting Sum between two dates from two tables broken down by field in one of the tables

I have 3 tables:
Table1 - Transactions
Table2 - Payments
Table3 - Date Table

 

Relationships:
Table1.DocDate <- Table3.Date
Table2.PmtDate <- Table3.DATEADD (inactive)
Table1.DocNo <-> Table2.DocNo

 

Looking to have a Matrix Showing, by Cust Class (which is only in Table1):
Total Sales (from Table1)
Total Pmts (from Table2)
Pmts 30-60 days old (from todays date) for that line, which is for that Customer Class
Pmts 61-90 days old (from todays date) for that line, which is for that Customer Class
Pmts Over 90 days old (from todays date) for that line, which is for that Customer Class

 

I get the Cust Class and the Total Sales and the Total Pmts. But the Aging breakdown I seem to be stuck on.

 

My measure for 30-60, for instamce, is:

30-60 Pmts =
VAR StartDate = DATEADD(Dates[Todays Date],-30,DAY)
VAR EndDate = DATEADD(Dates[Todays Date],-60,DAY)
RETURN

CALCULATE(SUM(view_PBI_AR_Dashboard_Aging_Payments[ApplyAmt]), Dates[Date]>=EndDate, Dates[Date]<=StartDate)

 

I have also tried:

 

30-60 Pmts =
VAR StartDate = DATEADD(Dates[Todays Date],-30,DAY)
VAR EndDate = DATEADD(Dates[Todays Date],-60,DAY)
RETURN

CALCULATE(SUM(view_PBI_AR_Dashboard_Aging_Payments[ApplyAmt]),USERELATIONSHIP(Dates[Date],view_PBI_AR_Dashboard_Aging_Payments[GLPostDate]),Dates[Date]>=EndDate, Dates[Date]<=StartDate)

 

I can't seem to get the right numbers. I'm likely going about this wrong, but am a bit lost. Any help would be apprecaited. Thanks!

 

dBrand_0-1672456187110.png

 

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and also show the expected result.


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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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